mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-09-10 14:11:58 +00:00
Compare commits
33 Commits
terraform-
...
12.10
Author | SHA1 | Date | |
---|---|---|---|
|
a83fc912e7 | ||
|
57c5a1c01a | ||
|
e7cbd1d2a7 | ||
|
da6e87e001 | ||
|
4197c29fce | ||
|
3d4785d5ae | ||
|
6c68658476 | ||
|
1bd439e0ec | ||
|
72f84ee50b | ||
|
50f26b9137 | ||
|
b6b1cc3ea0 | ||
|
0f1c1cdba1 | ||
|
841bc6844e | ||
|
a5bdf47f00 | ||
|
a0b279d1ff | ||
|
fb967dfa9e | ||
|
f0a51e1347 | ||
|
42d56f9d20 | ||
|
3f31e4b1a2 | ||
|
787a331869 | ||
|
5ce3a3ddd6 | ||
|
9ed96ec593 | ||
|
03b1fa8b09 | ||
|
d69f9b52c3 | ||
|
72b910bb48 | ||
|
cfaf3b280b | ||
|
00d814ec55 | ||
|
becabb3a41 | ||
|
033157800b | ||
|
b9c8ff91e4 | ||
|
c54d46ab67 | ||
|
dec514c5c2 | ||
|
7c5a8a1963 |
181
.github/dependabot.yml
vendored
181
.github/dependabot.yml
vendored
@@ -1,181 +0,0 @@
|
||||
version: 2
|
||||
registries:
|
||||
maven-repository-artifacts-alfresco-com-nexus-content-groups-int:
|
||||
type: maven-repository
|
||||
url: https://artifacts.alfresco.com/nexus/content/groups/internal
|
||||
username: ${{secrets.NEXUS_USERNAME}}
|
||||
password: ${{secrets.NEXUS_PASSWORD}}
|
||||
updates:
|
||||
- package-ecosystem: maven
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: daily
|
||||
time: "22:00"
|
||||
timezone: Africa/Abidjan
|
||||
open-pull-requests-limit: 99
|
||||
ignore:
|
||||
- dependency-name: com.google.code.gson:gson
|
||||
versions:
|
||||
- "> 2.8.6"
|
||||
- dependency-name: io.fabric8:fabric8-maven-plugin
|
||||
versions:
|
||||
- "> 4.4.0"
|
||||
- dependency-name: javax.servlet:javax.servlet-api
|
||||
versions:
|
||||
- "> 3.0.1"
|
||||
- dependency-name: org.acegisecurity:acegi-security
|
||||
versions:
|
||||
- "> 0.8.2_patched"
|
||||
- dependency-name: org.activiti:activiti-engine
|
||||
versions:
|
||||
- "> 5.23.0"
|
||||
- dependency-name: org.activiti:activiti-engine
|
||||
versions:
|
||||
- ">= 7.1.a, < 7.2"
|
||||
- dependency-name: org.activiti:activiti-spring
|
||||
versions:
|
||||
- "> 5.23.0"
|
||||
- dependency-name: org.activiti:activiti-spring
|
||||
versions:
|
||||
- ">= 7.1.a, < 7.2"
|
||||
- dependency-name: org.apache.camel:camel-activemq
|
||||
versions:
|
||||
- "> 3.7.1"
|
||||
- dependency-name: org.apache.camel:camel-amqp
|
||||
versions:
|
||||
- "> 3.7.1"
|
||||
- dependency-name: org.apache.camel:camel-direct
|
||||
versions:
|
||||
- "> 3.7.1"
|
||||
- dependency-name: org.apache.camel:camel-directvm
|
||||
versions:
|
||||
- "> 3.7.1"
|
||||
- dependency-name: org.apache.camel:camel-jackson
|
||||
versions:
|
||||
- "> 3.7.1"
|
||||
- dependency-name: org.apache.camel:camel-mock
|
||||
versions:
|
||||
- "> 3.7.1"
|
||||
- dependency-name: org.apache.camel:camel-spring
|
||||
versions:
|
||||
- "> 3.7.1"
|
||||
- dependency-name: org.apache.chemistry.opencmis:chemistry-opencmis-client-impl
|
||||
versions:
|
||||
- "> 1.0.0"
|
||||
- dependency-name: org.apache.chemistry.opencmis:chemistry-opencmis-commons-impl
|
||||
versions:
|
||||
- "> 1.0.0"
|
||||
- dependency-name: org.apache.chemistry.opencmis:chemistry-opencmis-server-bindings
|
||||
versions:
|
||||
- "> 1.0.0"
|
||||
- dependency-name: org.apache.chemistry.opencmis:chemistry-opencmis-test-tck
|
||||
versions:
|
||||
- "> 1.0.0"
|
||||
- dependency-name: org.freemarker:freemarker
|
||||
versions:
|
||||
- "> 2.3.20-alfresco-patched-20200421"
|
||||
- dependency-name: org.keycloak:keycloak-adapter-core
|
||||
versions:
|
||||
- "> 12.0.2"
|
||||
- dependency-name: org.keycloak:keycloak-adapter-spi
|
||||
versions:
|
||||
- "> 12.0.2"
|
||||
- dependency-name: org.keycloak:keycloak-authz-client
|
||||
versions:
|
||||
- "> 12.0.2"
|
||||
- dependency-name: org.keycloak:keycloak-common
|
||||
versions:
|
||||
- "> 12.0.2"
|
||||
- dependency-name: org.keycloak:keycloak-core
|
||||
versions:
|
||||
- "> 12.0.2"
|
||||
- dependency-name: org.keycloak:keycloak-servlet-adapter-spi
|
||||
versions:
|
||||
- "> 12.0.2"
|
||||
- dependency-name: org.eclipse.jetty:jetty-server
|
||||
versions:
|
||||
- 9.4.38.v20210224
|
||||
- dependency-name: org.alfresco.tas:cmis
|
||||
versions:
|
||||
- "1.28"
|
||||
- dependency-name: org.springframework:spring-webmvc
|
||||
versions:
|
||||
- 5.3.4
|
||||
- 5.3.5
|
||||
- dependency-name: org.springframework:spring-web
|
||||
versions:
|
||||
- 5.3.4
|
||||
- 5.3.5
|
||||
- dependency-name: org.springframework:spring-tx
|
||||
versions:
|
||||
- 5.3.4
|
||||
- 5.3.5
|
||||
- dependency-name: org.springframework:spring-orm
|
||||
versions:
|
||||
- 5.3.4
|
||||
- 5.3.5
|
||||
- dependency-name: org.springframework:spring-test
|
||||
versions:
|
||||
- 5.3.4
|
||||
- 5.3.5
|
||||
- dependency-name: org.springframework:spring-jms
|
||||
versions:
|
||||
- 5.3.4
|
||||
- 5.3.5
|
||||
- dependency-name: org.springframework:spring-jdbc
|
||||
versions:
|
||||
- 5.3.4
|
||||
- 5.3.5
|
||||
- dependency-name: org.springframework:spring-expression
|
||||
versions:
|
||||
- 5.3.4
|
||||
- 5.3.5
|
||||
- dependency-name: org.springframework:spring-core
|
||||
versions:
|
||||
- 5.3.4
|
||||
- 5.3.5
|
||||
- dependency-name: org.springframework:spring-context-support
|
||||
versions:
|
||||
- 5.3.4
|
||||
- 5.3.5
|
||||
- dependency-name: org.springframework:spring-context
|
||||
versions:
|
||||
- 5.3.4
|
||||
- 5.3.5
|
||||
- dependency-name: org.springframework:spring-beans
|
||||
versions:
|
||||
- 5.3.4
|
||||
- 5.3.5
|
||||
- dependency-name: org.springframework:spring-aop
|
||||
versions:
|
||||
- 5.3.4
|
||||
- 5.3.5
|
||||
- dependency-name: org.alfresco.tas:restapi
|
||||
versions:
|
||||
- "1.55"
|
||||
- dependency-name: org.eclipse.jetty:jetty-security
|
||||
versions:
|
||||
- 11.0.1
|
||||
- dependency-name: org.alfresco.aos-module:alfresco-vti-bin
|
||||
versions:
|
||||
- 1.4.0-M1
|
||||
- dependency-name: org.alfresco.aos-module:alfresco-aos-module-distributionzip
|
||||
versions:
|
||||
- 1.4.0-M1
|
||||
- dependency-name: org.alfresco.aos-module:alfresco-aos-module
|
||||
versions:
|
||||
- 1.4.0-M1
|
||||
- dependency-name: org.alfresco.surf:spring-webscripts-api
|
||||
versions:
|
||||
- "8.16"
|
||||
- dependency-name: org.alfresco.surf:spring-webscripts:tests
|
||||
versions:
|
||||
- "8.16"
|
||||
- dependency-name: org.alfresco.surf:spring-webscripts
|
||||
versions:
|
||||
- "8.16"
|
||||
- dependency-name: org.alfresco.surf:spring-surf-core-configservice
|
||||
versions:
|
||||
- "8.16"
|
||||
registries:
|
||||
- maven-repository-artifacts-alfresco-com-nexus-content-groups-int
|
5
.gitignore
vendored
5
.gitignore
vendored
@@ -24,17 +24,16 @@ target
|
||||
*.log.*
|
||||
|
||||
# Mobile Tools for Java (J2ME)
|
||||
|
||||
.mtj
|
||||
.tmp/
|
||||
|
||||
# Package Files #
|
||||
|
||||
*.jar
|
||||
*.war
|
||||
*.ear
|
||||
|
||||
# maven-shade-plugin for mmt tool
|
||||
dependency-reduced-pom.xml
|
||||
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
|
||||
hs_err_pid*
|
||||
|
11
.travis.yml
11
.travis.yml
@@ -43,11 +43,6 @@ install: travis_retry travis_wait 40 bash scripts/travis/build.sh
|
||||
|
||||
jobs:
|
||||
include:
|
||||
- name: "Source Clear Scan (SCA)"
|
||||
if: branch = master OR branch =~ /release\/.*/
|
||||
# Run Veracode
|
||||
install: skip
|
||||
script: travis_wait 30 bash scripts/travis/source_clear.sh
|
||||
|
||||
- name: "Core, Data-Model, Repository - AllUnitTestsSuite - Build and test"
|
||||
if: commit_message !~ /\[skip repo\]/
|
||||
@@ -150,8 +145,7 @@ jobs:
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.name=alfresco -Ddb.url=jdbc:mariadb://localhost:3307/alfresco?useUnicode=yes\&characterEncoding=UTF-8 -Ddb.username=alfresco -Ddb.password=alfresco -Ddb.driver=org.mariadb.jdbc.Driver
|
||||
|
||||
- name: "Repository - MariaDB 10.6 tests"
|
||||
# We run tests on the latest version of MariaDB on pull requests plus the normal master and release branches - ignored on feature branches
|
||||
if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip db\]/ ) OR commit_message =~ /\[db\]/ OR commit_message =~ /\[latest db\]/
|
||||
if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip db\]/ AND type != pull_request) OR commit_message =~ /\[db\]/ OR commit_message =~ /\[latest db\]/
|
||||
before_script:
|
||||
- docker run -d -p 3307:3306 --name mariadb -e MYSQL_ROOT_PASSWORD=alfresco -e MYSQL_USER=alfresco -e MYSQL_DATABASE=alfresco -e MYSQL_PASSWORD=alfresco mariadb:10.6 --transaction-isolation=READ-COMMITTED --max-connections=300 --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
@@ -165,8 +159,7 @@ jobs:
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.driver=com.mysql.jdbc.Driver -Ddb.name=alfresco -Ddb.url=jdbc:mysql://localhost:3307/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Repository - MySQL 8 tests"
|
||||
# We run tests on the latest version of MySQL on pull requests plus the normal master and release branches - ignored on feature branches
|
||||
if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip db\]/ ) OR commit_message =~ /\[db\]/ OR commit_message =~ /\[latest db\]/
|
||||
if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip db\]/ AND type != pull_request) OR commit_message =~ /\[db\]/ OR commit_message =~ /\[latest db\]/
|
||||
before_script:
|
||||
- docker run -d -p 3307:3306 -e MYSQL_ROOT_PASSWORD=alfresco -e MYSQL_USER=alfresco -e MYSQL_DATABASE=alfresco -e MYSQL_PASSWORD=alfresco mysql:8 --transaction-isolation='READ-COMMITTED'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
|
76
README.md
76
README.md
@@ -2,6 +2,13 @@
|
||||
|
||||
[](https://travis-ci.com/Alfresco/alfresco-community-repo)
|
||||
|
||||
This project contains the bulk of the [Alfresco Content Services Repository](https://community.alfresco.com/docs/DOC-6385-project-overview-repository) code.
|
||||
|
||||
To make the development process simpler, it brings together code historically in `alfresco-core`,
|
||||
`alfresco-data-madel`, `alfresco-repository`, `alfresco-remote-api` and repository specific
|
||||
tests and war file creation from `acs-community-packaging`. They exist as sub projects within the Maven Reactor and still
|
||||
create the same artifacts.
|
||||
|
||||
#### Alfresco Core
|
||||
|
||||
Alfresco Core is a library packaged as a jar file which contains the following:
|
||||
@@ -9,6 +16,8 @@ Alfresco Core is a library packaged as a jar file which contains the following:
|
||||
* Canned queries interface and supporting classes
|
||||
* Generic encryption supporting classes
|
||||
|
||||
Version 7 of the library uses Spring 5, Quartz 2.3 and does not have Hibernate dependency.
|
||||
|
||||
#### Alfresco Data Model
|
||||
Data model is a library packaged as a jar file which contains the following:
|
||||
* Dictionary, Repository and Search Services interfaces
|
||||
@@ -22,6 +31,14 @@ Repository is a library packaged as a jar file which contains the following:
|
||||
* Various Service implementations
|
||||
* Utility classes
|
||||
|
||||
Tests are combined into test classes split by test type or Spring application context used in the test, see classes
|
||||
in _src/test/java/org/alfresco_. All of these classes as well as individual tests can be run by specifying the test
|
||||
class name and a set of DB connection properties. Check the travis.yml file for docker images that should be started
|
||||
to provide a suitable test environment. For example:
|
||||
~~~
|
||||
mvn clean test -Dtest=SomeRepoTest -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql:alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
~~~
|
||||
|
||||
#### Alfresco Remote API
|
||||
|
||||
Remote API is a library packaged as a jar file which contains the following:
|
||||
@@ -29,10 +46,13 @@ Remote API is a library packaged as a jar file which contains the following:
|
||||
* WebScript implementations including [V1 REST APIs](https://community.alfresco.com/community/ecm/blog/2017/05/02/v1-rest-api-10-things-you-should-know)
|
||||
* [OpenCMIS](https://chemistry.apache.org/java/opencmis.html) implementations
|
||||
|
||||
Like the `alfresco-repository` tests are combined in test classes split by test type or Spring application context used
|
||||
in the test.
|
||||
|
||||
#### Artifacts
|
||||
The artifacts can be obtained by:
|
||||
* downloading from [Alfresco maven repository](https://artifacts.alfresco.com/nexus/content/groups/public)
|
||||
* as Maven dependency by adding the dependency to your pom file:
|
||||
* getting as Maven dependency by adding the dependency to your pom file:
|
||||
~~~
|
||||
<dependency>
|
||||
<groupId>org.alfresco</groupId>
|
||||
@@ -74,24 +94,40 @@ and Alfresco maven repository:
|
||||
~~~
|
||||
The SNAPSHOT versions of the artifact are not published.
|
||||
|
||||
## Setting up and building your development environment
|
||||
See the [Development Tomcat Environment](https://github.com/Alfresco/acs-community-packaging/tree/master/dev/README.md)
|
||||
page which will show you how to try out your repository changes in a local tomcat instance.
|
||||
If you wish to use Docker images, take a look at the aliases ending in `D` and the docker-compose files in this
|
||||
project's test modules.
|
||||
|
||||
## Branches
|
||||
This project has a branch for each ACS release. For example the code in ACS 6.2.1 is a
|
||||
branch called `releases/6.2.2`. In addition to the original 6.2.2 release it will also contain Hot Fixes
|
||||
added later. The latest unreleased code is on the `master` branch. There are also `.N` branches, such as
|
||||
`releases/7.1.N` on which we gather unreleased fixes for future service pack releases. They do not indicate
|
||||
that one is planned.
|
||||
|
||||
For historic reasons the version of artifacts created on each branch do not match the ACS version.
|
||||
For example artifact in ACS 7.2.0 will be `14.<something>`.
|
||||
|
||||
The enterprise projects which extend the `alfresco-community-repo` use the same branch names and leading
|
||||
artifact version number.
|
||||
All current source versions are held in github. Historic versions can be found in [Alfresco SVN](https://svn.alfresco.com/repos/alfresco-open-mirror/services/alfresco-core/)
|
||||
|
||||
### Contributing guide
|
||||
Please use [this guide](CONTRIBUTING.md) to make a contribution to the project.
|
||||
Please use [this guide](CONTRIBUTING.md) to make a contribution to the project.
|
||||
|
||||
## Setting up your development environment
|
||||
Although it is possible to work on individual github projects, we recommend working on the `alfresco-community-repo`
|
||||
and `acs-community-packaging` in a single Intellij IDEA project. They depend on each other and typically you will
|
||||
want to make changes to both of them if you are changing the repository code.
|
||||
|
||||
~~~
|
||||
mkdir work
|
||||
cd work
|
||||
git clone git@github.com:Alfresco/alfresco-community-repo.git
|
||||
git clone git@github.com:Alfresco/acs-community-packaging.git
|
||||
~~~
|
||||
If you wish to build these projects from the command line, use the following commands.
|
||||
~~~
|
||||
cd alfresco-community-repo
|
||||
mvn clean install -Pbuild-docker-images -DskipTests=true -Dversion.edition=Community
|
||||
cd ..
|
||||
|
||||
cd acs-community-packaging
|
||||
mvn clean install -Pbuild-docker-images -Dmaven.javadoc.skip=true
|
||||
cd ..
|
||||
~~~
|
||||
In Intellij IDEA, create a new project using the `work` directory as the source.
|
||||
* File > New Project from Existing Sources > .../work > Maven
|
||||
|
||||
## Branches
|
||||
As multiple projects have been combined, branch names use the ACS version they are targeting.
|
||||
For example the code used to create the repository in ACS 6.2.1 is a branch called `releases/6.2.1`.
|
||||
|
||||
The actual version number of the **repository artifacts** created by `alfresco-community-repo` are however different.
|
||||
For example `release/6.2.1` artifacts are `7.183.x`. This adds some complexity, but ensures that
|
||||
version numbers do not go backwards in existing releases. It also provides some level of
|
||||
independence between the repository and other ACS components.
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-amps</artifactId>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
<version>12.10</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-governance-services-community-parent</artifactId>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
<version>12.10</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-governance-services-automation-community-repo</artifactId>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
<version>12.10</version>
|
||||
</parent>
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<version>1.7.32</version>
|
||||
<version>1.7.26</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@@ -82,7 +82,7 @@
|
||||
<dependency>
|
||||
<groupId>com.github.docker-java</groupId>
|
||||
<artifactId>docker-java</artifactId>
|
||||
<version>3.2.12</version>
|
||||
<version>3.2.11</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
@@ -1,89 +0,0 @@
|
||||
# dataprep related
|
||||
alfresco.scheme=http
|
||||
alfresco.server=localhost
|
||||
alfresco.port=8082
|
||||
|
||||
# sync service related
|
||||
sync.scheme=http
|
||||
sync.server=localhost
|
||||
sync.port=9090
|
||||
|
||||
# Solr Server Settings
|
||||
solr.scheme=http
|
||||
solr.server=localhost
|
||||
solr.port=8083
|
||||
|
||||
#Solr Indexing Time
|
||||
solrWaitTimeInSeconds=20
|
||||
|
||||
# credentials
|
||||
admin.user=admin
|
||||
admin.password=admin
|
||||
|
||||
# Identity Service configuration
|
||||
# set this property to run tests using AIS
|
||||
# identity-service.auth-server-url=http://localhost:8999/auth
|
||||
|
||||
# in containers we cannot access directly JMX, so we will use http://jolokia.org agent
|
||||
# disabling this we will use direct JMX calls to server
|
||||
jmx.useJolokiaAgent=false
|
||||
|
||||
# Server Health section
|
||||
# in ServerHealth#isServerReachable() - could also be shown.
|
||||
# enable this option to view if on server there are tenants or not
|
||||
serverHealth.showTenants=false
|
||||
|
||||
# TEST MANAGEMENT SECTION - Test Rail
|
||||
#
|
||||
# (currently supporting Test Rail v5.2.1.3472 integration)
|
||||
#
|
||||
# Example of configuration:
|
||||
# ------------------------------------------------------
|
||||
# if testManagement.enabled=true we enabled TestRailExecutorListener (if used in your suite xml file)
|
||||
# testManagement.updateTestExecutionResultsOnly=true (this will just update the results of a test: no step will be updated - good for performance)
|
||||
# testManagement.endPoint=https://alfresco.testrail.com/
|
||||
# testManagement.username=<username>
|
||||
# testManagement.apiKey=<api-key>
|
||||
# testManagement.project=<id-of-your-project
|
||||
# testManagement.testRun=<test-run-name>
|
||||
# testManagement.includeOnlyTestCasesExecuted=true #if you want to include in your run ONLY the test cases that you run, then set this value to false
|
||||
# testManagement.rateLimitInSeconds=1 #is the default rate limit after what minimum time, should we upload the next request. http://docs.gurock.com/testrail-api2/introduction #Rate Limit
|
||||
# testManagement.suiteId=23 (the id of the Master suite)
|
||||
# ------------------------------------------------------
|
||||
testManagement.enabled=false
|
||||
testManagement.endPoint=https://alfresco.testrail.com/
|
||||
testManagement.username=
|
||||
testManagement.apiKey=
|
||||
testManagement.project=7
|
||||
testManagement.includeOnlyTestCasesExecuted=true
|
||||
testManagement.rateLimitInSeconds=1
|
||||
testManagement.testRun=MyTestRunInTestRail
|
||||
testManagement.suiteId=12
|
||||
|
||||
# The location of the reports path
|
||||
reports.path=./target/reports
|
||||
|
||||
#
|
||||
# Database Section
|
||||
# You should provide here the database URL, that can be a differed server as alfresco.
|
||||
# https://docs.oracle.com/javase/tutorial/jdbc/basics/connecting.html
|
||||
#
|
||||
# Current supported db.url:
|
||||
#
|
||||
# MySQL:
|
||||
# db.url = jdbc:mysql://${alfresco.server}:3306/alfresco
|
||||
#
|
||||
# PostgreSQL:
|
||||
# db.url = jdbc:postgresql://<your-DB-IP>:3306/alfresco
|
||||
#
|
||||
# Oracle:
|
||||
# db.url = jdbc:oracle://<your-DB-IP>:3306/alfresco
|
||||
#
|
||||
# MariaDB:
|
||||
# db.url = jdbc:mariadb://<your-DB-IP>:3306/alfresco
|
||||
#
|
||||
db.url = jdbc:mysql://${alfresco.server}:3306/alfresco
|
||||
db.username = alfresco
|
||||
db.password = alfresco
|
||||
|
||||
environment=default
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-governance-services-community-parent</artifactId>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
<version>12.10</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -8,7 +8,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-governance-services-community-repo-parent</artifactId>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
<version>12.10</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
@@ -108,7 +108,7 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
<artifactId>mockito-all</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@@ -27,9 +27,8 @@
|
||||
|
||||
package org.alfresco.module.org_alfresco_module_rm.action.dm;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.ArgumentMatchers.nullable;
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Matchers.eq;
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.never;
|
||||
@@ -353,7 +352,7 @@ public class DeclareAsVersionRecordActionUnitTest extends BaseActionUnitTest
|
||||
private void setupMockedAspects()
|
||||
{
|
||||
doReturn(true).when(mockedNodeService).exists(actionedUponNodeRef);
|
||||
doReturn(true).when(mockedDictionaryService).isSubClass(nullable(QName.class), eq(ContentModel.TYPE_CONTENT));
|
||||
doReturn(true).when(mockedDictionaryService).isSubClass(any(QName.class), eq(ContentModel.TYPE_CONTENT));
|
||||
doReturn(true).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_VERSIONABLE);
|
||||
doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_RECORD);
|
||||
doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_WORKING_COPY);
|
||||
|
@@ -36,13 +36,15 @@ import org.junit.Test;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.anyMap;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.ArgumentMatchers.isNull;
|
||||
import static org.mockito.ArgumentMatchers.nullable;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Matchers.eq;
|
||||
import static org.mockito.Matchers.isNull;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
import static org.mockito.MockitoAnnotations.initMocks;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link AddToHoldAuditEvent}.
|
||||
@@ -65,6 +67,8 @@ public class AddToHoldAuditEventUnitTest extends BaseUnitTest
|
||||
@Before
|
||||
public void setUp()
|
||||
{
|
||||
initMocks(this);
|
||||
|
||||
holdNodeRef = generateNodeRef();
|
||||
String holdName = "Hold " + GUID.generate();
|
||||
|
||||
@@ -83,6 +87,6 @@ public class AddToHoldAuditEventUnitTest extends BaseUnitTest
|
||||
public void testAddToHoldCausesAuditEvent()
|
||||
{
|
||||
addToHoldAuditEvent.onAddToHold(holdNodeRef, contentNodeRef);
|
||||
verify(mockedRecordsManagementAuditService, times(1)).auditEvent(eq(contentNodeRef), nullable(String.class), isNull(), anyMap(), eq(true), eq(false));
|
||||
verify(mockedRecordsManagementAuditService, times(1)).auditEvent(eq(contentNodeRef), any(String.class), isNull(Map.class), any(Map.class), eq(true), eq(false));
|
||||
}
|
||||
}
|
||||
|
@@ -37,13 +37,15 @@ import org.junit.Test;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.anyMap;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.ArgumentMatchers.isNull;
|
||||
import static org.mockito.ArgumentMatchers.nullable;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Matchers.eq;
|
||||
import static org.mockito.Matchers.isNull;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
import static org.mockito.MockitoAnnotations.initMocks;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link CreateHoldAuditEvent}.
|
||||
@@ -66,6 +68,8 @@ public class CreateHoldAuditEventUnitTest extends BaseUnitTest
|
||||
@Before
|
||||
public void setUp()
|
||||
{
|
||||
initMocks(this);
|
||||
|
||||
holdNodeRef = generateNodeRef();
|
||||
String holdName = "Hold " + GUID.generate();
|
||||
String holdReason = "Reason " + GUID.generate();
|
||||
@@ -84,6 +88,6 @@ public class CreateHoldAuditEventUnitTest extends BaseUnitTest
|
||||
public void testCreateHoldCausesAuditEvent()
|
||||
{
|
||||
createHoldAuditEvent.onCreateNode(childAssociationRef);
|
||||
verify(mockedRecordsManagementAuditService, times(1)).auditEvent(eq(holdNodeRef), nullable(String.class), isNull(), anyMap());
|
||||
verify(mockedRecordsManagementAuditService, times(1)).auditEvent(eq(holdNodeRef), any(String.class), isNull(Map.class), any(Map.class));
|
||||
}
|
||||
}
|
||||
|
@@ -34,15 +34,18 @@ import org.alfresco.util.GUID;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Matchers;
|
||||
import org.mockito.Mock;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.anyMap;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.ArgumentMatchers.isNull;
|
||||
import static org.mockito.ArgumentMatchers.nullable;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Matchers.eq;
|
||||
import static org.mockito.Matchers.isNull;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
import static org.mockito.MockitoAnnotations.initMocks;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link DeleteHoldAuditEvent}.
|
||||
@@ -64,6 +67,8 @@ public class DeleteHoldAuditEventUnitTest extends BaseUnitTest
|
||||
@Before
|
||||
public void setUp()
|
||||
{
|
||||
initMocks(this);
|
||||
|
||||
holdNodeRef = generateNodeRef();
|
||||
String holdName = "Hold " + GUID.generate();
|
||||
|
||||
@@ -79,6 +84,6 @@ public class DeleteHoldAuditEventUnitTest extends BaseUnitTest
|
||||
{
|
||||
deleteHoldAuditEvent.beforeDeleteNode(holdNodeRef);
|
||||
verify(mockedRecordsManagementAuditService, times(1))
|
||||
.auditEvent(eq(holdNodeRef), nullable(String.class), anyMap(), isNull(), eq(true), eq(false));
|
||||
.auditEvent(eq(holdNodeRef), any(String.class), any(Map.class), isNull(Map.class), Matchers.eq(true), Matchers.eq(false));
|
||||
}
|
||||
}
|
||||
|
@@ -27,24 +27,25 @@
|
||||
|
||||
package org.alfresco.module.org_alfresco_module_rm.audit.event;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.anyMap;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.ArgumentMatchers.isNull;
|
||||
import static org.mockito.ArgumentMatchers.nullable;
|
||||
import static org.mockito.Mockito.lenient;
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Matchers.eq;
|
||||
import static org.mockito.Matchers.isNull;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
import static org.mockito.MockitoAnnotations.initMocks;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.util.GUID;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link RemoveFromHoldAuditEvent}.
|
||||
@@ -52,7 +53,6 @@ import org.mockito.junit.MockitoJUnitRunner;
|
||||
* @author Chris Shields
|
||||
* @since 3.3
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class RemoveFromHoldAuditEventUnitTest extends BaseUnitTest
|
||||
{
|
||||
@InjectMocks
|
||||
@@ -70,14 +70,16 @@ public class RemoveFromHoldAuditEventUnitTest extends BaseUnitTest
|
||||
@Before
|
||||
public void setUp()
|
||||
{
|
||||
initMocks(this);
|
||||
|
||||
holdNodeRef = generateNodeRef();
|
||||
String holdName = "Hold " + GUID.generate();
|
||||
|
||||
contentNodeRef = generateNodeRef();
|
||||
String contentName = "Content " + GUID.generate();
|
||||
|
||||
lenient().when(mockedNodeService.getProperty(holdNodeRef, PROP_NAME)).thenReturn(holdName);
|
||||
lenient().when(mockedNodeService.getProperty(contentNodeRef, PROP_NAME)).thenReturn(contentName);
|
||||
when(mockedNodeService.getProperty(holdNodeRef, PROP_NAME)).thenReturn(holdName);
|
||||
when(mockedNodeService.getProperty(contentNodeRef, PROP_NAME)).thenReturn(contentName);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -87,7 +89,7 @@ public class RemoveFromHoldAuditEventUnitTest extends BaseUnitTest
|
||||
public void testRemoveFromHoldCausesAuditEvent()
|
||||
{
|
||||
removeFromHoldAuditEvent.onRemoveFromHold(holdNodeRef, contentNodeRef);
|
||||
verify(mockedRecordsManagementAuditService, times(1)).auditEvent(eq(contentNodeRef), nullable(String.class), anyMap(), isNull(), eq(true));
|
||||
verify(mockedRecordsManagementAuditService, times(1)).auditEvent(eq(contentNodeRef), any(String.class), any(Map.class), isNull(Map.class), eq(true));
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -28,14 +28,14 @@
|
||||
package org.alfresco.module.org_alfresco_module_rm.forms;
|
||||
|
||||
import static org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock.generateQName;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyList;
|
||||
import static org.mockito.ArgumentMatchers.nullable;
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Matchers.anyListOf;
|
||||
import static org.mockito.Matchers.anyString;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.verifyNoMoreInteractions;
|
||||
import static org.mockito.Mockito.verifyZeroInteractions;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -45,6 +45,7 @@ import java.util.Map;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest;
|
||||
import org.alfresco.repo.forms.Field;
|
||||
import org.alfresco.repo.forms.FieldDefinition;
|
||||
import org.alfresco.repo.forms.Form;
|
||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||
@@ -80,7 +81,7 @@ public class RecordsManagementTypeFormFilterUnitTest extends BaseUnitTest
|
||||
public void testAddCustomRMPropertiesNoneFound()
|
||||
{
|
||||
typeFormFilter.addCustomRMProperties(MY_CUSTOM_TYPE, mockForm);
|
||||
verifyNoMoreInteractions(mockForm);
|
||||
verifyZeroInteractions(mockForm);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -129,8 +130,8 @@ public class RecordsManagementTypeFormFilterUnitTest extends BaseUnitTest
|
||||
|
||||
typeFormFilter.afterGenerate(mockTypeDefinition, null, null, mockForm, null);
|
||||
|
||||
verify(mockedIdentifierService).generateIdentifier(nullable(QName.class), nullable(NodeRef.class));
|
||||
verify(idDef).setDefaultValue(nullable(String.class));
|
||||
verify(mockedIdentifierService).generateIdentifier(any(QName.class), any(NodeRef.class));
|
||||
verify(idDef).setDefaultValue(anyString());
|
||||
verify(vrDef).setDefaultValue(Boolean.FALSE.toString());
|
||||
verify(rpDef).setDefaultValue("none|0");
|
||||
}
|
||||
@@ -161,7 +162,7 @@ public class RecordsManagementTypeFormFilterUnitTest extends BaseUnitTest
|
||||
typeFormFilter.addCustomRMProperties(MY_CUSTOM_TYPE, mockForm);
|
||||
|
||||
// ensure that two custom properties have been added to the form
|
||||
verify(mockForm, times(1)).addFields(anyList());
|
||||
verify(mockForm, times(1)).addFields(anyListOf(Field.class));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -30,16 +30,16 @@ package org.alfresco.module.org_alfresco_module_rm.job;
|
||||
import static org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock.generateQName;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyBoolean;
|
||||
import static org.mockito.ArgumentMatchers.anyMap;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Matchers.anyMap;
|
||||
import static org.mockito.Matchers.eq;
|
||||
import static org.mockito.Mockito.doAnswer;
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.verifyNoMoreInteractions;
|
||||
import static org.mockito.Mockito.verifyZeroInteractions;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.util.Arrays;
|
||||
@@ -57,6 +57,7 @@ import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Matchers;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.stubbing.Answer;
|
||||
|
||||
@@ -97,7 +98,7 @@ public class DispositionLifecycleJobExecuterUnitTest extends BaseUnitTest
|
||||
return callback.execute();
|
||||
};
|
||||
doAnswer(doInTransactionAnswer).when(mockedRetryingTransactionHelper).doInTransaction(any(RetryingTransactionCallback.class),
|
||||
anyBoolean(), anyBoolean());
|
||||
Matchers.anyBoolean(), Matchers.anyBoolean());
|
||||
|
||||
// setup data
|
||||
List<String> dispositionActions = buildList(CUTOFF, RETAIN);
|
||||
@@ -140,7 +141,7 @@ public class DispositionLifecycleJobExecuterUnitTest extends BaseUnitTest
|
||||
verifyQueryTimes(1);
|
||||
|
||||
// ensure nothing else happens becuase we have no results
|
||||
verifyNoMoreInteractions(mockedNodeService, mockedRecordFolderService, mockedRetryingTransactionHelper);
|
||||
verifyZeroInteractions(mockedNodeService, mockedRecordFolderService, mockedRetryingTransactionHelper);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -177,7 +178,7 @@ public class DispositionLifecycleJobExecuterUnitTest extends BaseUnitTest
|
||||
// ensure work is executed in transaction for each node processed
|
||||
verify(mockedNodeService, times(2)).exists(any(NodeRef.class));
|
||||
verify(mockedRetryingTransactionHelper, times(2)).doInTransaction(any(RetryingTransactionCallback.class),
|
||||
anyBoolean(), anyBoolean());
|
||||
Matchers.anyBoolean(), Matchers.anyBoolean());
|
||||
|
||||
// ensure each node is process correctly
|
||||
verify(mockedNodeService, times(1)).getProperty(node1, RecordsManagementModel.PROP_DISPOSITION_ACTION);
|
||||
@@ -185,7 +186,7 @@ public class DispositionLifecycleJobExecuterUnitTest extends BaseUnitTest
|
||||
|
||||
// ensure no more interactions
|
||||
verifyNoMoreInteractions(mockedNodeService);
|
||||
verifyNoMoreInteractions(mockedRecordsManagementActionService);
|
||||
verifyZeroInteractions(mockedRecordsManagementActionService);
|
||||
|
||||
}
|
||||
|
||||
@@ -215,7 +216,7 @@ public class DispositionLifecycleJobExecuterUnitTest extends BaseUnitTest
|
||||
|
||||
// ensure no more interactions
|
||||
verifyNoMoreInteractions(mockedNodeService);
|
||||
verifyNoMoreInteractions(mockedRecordsManagementActionService);
|
||||
verifyZeroInteractions(mockedRecordsManagementActionService);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -257,7 +258,7 @@ public class DispositionLifecycleJobExecuterUnitTest extends BaseUnitTest
|
||||
// ensure work is executed in transaction for each node processed
|
||||
verify(mockedNodeService, times(2)).exists(any(NodeRef.class));
|
||||
verify(mockedRetryingTransactionHelper, times(2)).doInTransaction(any(RetryingTransactionCallback.class),
|
||||
anyBoolean(), anyBoolean());
|
||||
Matchers.anyBoolean(), Matchers.anyBoolean());
|
||||
|
||||
// ensure each node is process correctly
|
||||
// node1
|
||||
@@ -306,7 +307,7 @@ public class DispositionLifecycleJobExecuterUnitTest extends BaseUnitTest
|
||||
|
||||
// mock the search service to return the right page
|
||||
when(mockedSearchService.query(any(SearchParameters.class))).thenAnswer((Answer<ResultSet>) invocation -> {
|
||||
SearchParameters params = invocation.getArgument(0, SearchParameters.class);
|
||||
SearchParameters params = invocation.getArgumentAt(0, SearchParameters.class);
|
||||
if (params.getSkipCount() == 0)
|
||||
{
|
||||
// mock first page
|
||||
|
@@ -27,15 +27,17 @@
|
||||
package org.alfresco.module.org_alfresco_module_rm.model.rma.aspect;
|
||||
|
||||
import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.ASPECT_HELD_CHILDREN;
|
||||
import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.ASPECT_RECORD;
|
||||
import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.PROP_HELD_CHILDREN_COUNT;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyMap;
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Matchers.anyMap;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService;
|
||||
@@ -49,22 +51,24 @@ import org.alfresco.service.cmr.repository.NodeService;
|
||||
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;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
|
||||
/**
|
||||
* Test class for frozen aspect
|
||||
* @author Ross Gale
|
||||
* @since 3.2
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class FrozenAspectUnitTest
|
||||
{
|
||||
@Mock
|
||||
private NodeService mockNodeService;
|
||||
|
||||
@Mock
|
||||
private ApplicationContext mockApplicationContext;
|
||||
|
||||
@Mock
|
||||
private ChildAssociationRef mockChildAssociationRef;
|
||||
|
||||
@@ -86,6 +90,9 @@ public class FrozenAspectUnitTest
|
||||
@Mock
|
||||
private ChildAssociationRef mockOldRef;
|
||||
|
||||
@Mock
|
||||
private Set mockSet;
|
||||
|
||||
@Mock
|
||||
private PropertyModificationAllowedCheck mockPropertyModificationAllowedCheck;
|
||||
|
||||
@@ -103,17 +110,18 @@ public class FrozenAspectUnitTest
|
||||
@Before
|
||||
public void setUp()
|
||||
{
|
||||
MockitoAnnotations.initMocks(this);
|
||||
when(mockNodeService.exists(record)).thenReturn(true);
|
||||
when(mockNodeService.getType(record)).thenReturn(ContentModel.TYPE_CONTENT);
|
||||
when(mockedNodeTypeUtility.instanceOf(mockNodeService.getType(record), ContentModel.TYPE_CONTENT)).thenReturn(true);
|
||||
when(mockNodeService.exists(content)).thenReturn(true);
|
||||
when(mockNodeService.hasAspect(folder, ASPECT_HELD_CHILDREN)).thenReturn(true);
|
||||
when(mockNodeService.getProperty(folder, PROP_HELD_CHILDREN_COUNT)).thenReturn(1);
|
||||
when(mockApplicationContext.getBean("dbNodeService")).thenReturn(mockNodeService);
|
||||
when(mockFreezeService.isFrozen(content)).thenReturn(false);
|
||||
children.add(mockChildRef);
|
||||
when(mockNodeService.getChildAssocs(content)).thenReturn(children);
|
||||
when(mockChildRef.isPrimary()).thenReturn(true);
|
||||
frozenAspect.setNodeService(mockNodeService);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -134,6 +142,7 @@ public class FrozenAspectUnitTest
|
||||
@Test
|
||||
public void testRemoveAspectForContent()
|
||||
{
|
||||
when(mockNodeService.hasAspect(content, ASPECT_RECORD)).thenReturn(false);
|
||||
when(mockNodeService.getType(content)).thenReturn(ContentModel.TYPE_CONTENT);
|
||||
when(mockedNodeTypeUtility.instanceOf(mockNodeService.getType(content), ContentModel.TYPE_CONTENT)).thenReturn(true);
|
||||
when(mockNodeService.getPrimaryParent(content)).thenReturn(mockChildAssociationRef);
|
||||
@@ -148,6 +157,7 @@ public class FrozenAspectUnitTest
|
||||
@Test
|
||||
public void testRemoveAspectForContentDoesntUpdateForOtherTypes()
|
||||
{
|
||||
when(mockNodeService.hasAspect(content, ASPECT_RECORD)).thenReturn(false);
|
||||
when(mockNodeService.getType(content)).thenReturn(ContentModel.TYPE_FOLDER);
|
||||
when(mockedNodeTypeUtility.instanceOf(mockNodeService.getType(content), ContentModel.TYPE_CONTENT)).thenReturn(false);
|
||||
frozenAspect.onRemoveAspect(content, null);
|
||||
@@ -223,6 +233,7 @@ public class FrozenAspectUnitTest
|
||||
@Test(expected = PermissionDeniedException.class)
|
||||
public void testBeforeMoveThrowsExceptionForFrozenNode()
|
||||
{
|
||||
when(mockOldRef.getParentRef()).thenReturn(parent);
|
||||
when(mockOldRef.getChildRef()).thenReturn(child);
|
||||
when(mockNodeService.exists(child)).thenReturn(true);
|
||||
when(mockFreezeService.isFrozen(child)).thenReturn(true);
|
||||
@@ -236,6 +247,8 @@ public class FrozenAspectUnitTest
|
||||
public void testUpdatePropertiesThrowsExceptionForFrozenNode()
|
||||
{
|
||||
when(mockFreezeService.isFrozen(content)).thenReturn(true);
|
||||
when(mockResourceHelper.getSet(content)).thenReturn(mockSet);
|
||||
when(mockSet.contains("frozen")).thenReturn(false);
|
||||
when(mockPropertyModificationAllowedCheck.check(null, null)).thenReturn(false);
|
||||
frozenAspect.onUpdateProperties(content, null, null);
|
||||
}
|
||||
|
@@ -33,6 +33,7 @@ import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagement
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
import static org.mockito.MockitoAnnotations.initMocks;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService;
|
||||
@@ -42,17 +43,14 @@ import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Unit tests for the {@link RecordAspect}.
|
||||
*
|
||||
* @author Claudia Agache
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class RecordAspectUnitTest
|
||||
{
|
||||
private static final NodeRef NODE_REF = new NodeRef("node://Ref/");
|
||||
@@ -74,7 +72,7 @@ public class RecordAspectUnitTest
|
||||
@Before
|
||||
public void setUp()
|
||||
{
|
||||
recordAspect.setNodeService(mockNodeService);
|
||||
initMocks(this);
|
||||
}
|
||||
|
||||
/** Check that the bin is duplicated before adding the aspect if the file has a copy. */
|
||||
|
@@ -45,15 +45,13 @@ import org.alfresco.service.cmr.repository.StoreRef;
|
||||
import org.alfresco.util.GUID;
|
||||
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;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
|
||||
/**
|
||||
* @author silviudinuta
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class NonElectronicRecordTypeUnitTest implements RecordsManagementModel, ContentModel
|
||||
{
|
||||
private final static NodeRef CHILD_NODE_REF = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE,
|
||||
@@ -76,15 +74,17 @@ public class NonElectronicRecordTypeUnitTest implements RecordsManagementModel,
|
||||
@Before
|
||||
public void setUp()
|
||||
{
|
||||
MockitoAnnotations.initMocks(this);
|
||||
MockAuthenticationUtilHelper.setup(mockAuthenticationUtil);
|
||||
when(mockedNodeService.exists(CHILD_NODE_REF)).thenReturn(true);
|
||||
when(mockedNodeService.exists(PARENT_NODE_REF)).thenReturn(true);
|
||||
|
||||
ChildAssociationRef generateChildAssociationRef = mock(ChildAssociationRef.class);
|
||||
when(generateChildAssociationRef.getParentRef()).thenReturn(PARENT_NODE_REF);
|
||||
when(generateChildAssociationRef.getChildRef()).thenReturn(CHILD_NODE_REF);
|
||||
|
||||
when(mockedNodeService.getPrimaryParent(CHILD_NODE_REF)).thenReturn(generateChildAssociationRef);
|
||||
when(mockedNodeService.getType(PARENT_NODE_REF)).thenReturn(TYPE_UNFILED_RECORD_FOLDER);
|
||||
nonElectronicRecordType.setNodeService(mockedNodeService);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@@ -27,7 +27,6 @@
|
||||
|
||||
package org.alfresco.module.org_alfresco_module_rm.script.hold;
|
||||
|
||||
import static org.mockito.Mockito.lenient;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -72,8 +71,8 @@ public abstract class BaseHoldWebScriptUnitTest extends BaseWebScriptUnitTest
|
||||
|
||||
// generate active content
|
||||
dmNodeRef = generateNodeRef(TYPE_CONTENT);
|
||||
lenient().when(mockedExtendedPermissionService.hasPermission(dmNodeRef, PermissionService.WRITE)).thenReturn(AccessStatus.ALLOWED);
|
||||
lenient().when(mockedDictionaryService.isSubClass(mockedNodeService.getType(dmNodeRef), ContentModel.TYPE_CONTENT)).thenReturn(true);
|
||||
when(mockedExtendedPermissionService.hasPermission(dmNodeRef, PermissionService.WRITE)).thenReturn(AccessStatus.ALLOWED);
|
||||
when(mockedDictionaryService.isSubClass(mockedNodeService.getType(dmNodeRef), ContentModel.TYPE_CONTENT)).thenReturn(true);
|
||||
|
||||
// list of active contents
|
||||
activeContents = Collections.singletonList(dmNodeRef);
|
||||
|
@@ -37,12 +37,9 @@ import java.util.List;
|
||||
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.json.JSONObject;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Spy;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
import org.springframework.extensions.webscripts.DeclarativeWebScript;
|
||||
|
||||
/**
|
||||
@@ -51,7 +48,6 @@ import org.springframework.extensions.webscripts.DeclarativeWebScript;
|
||||
* @author Roy Wetherall
|
||||
* @since 2.2
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class HoldPutUnitTest extends BaseHoldWebScriptWithContentUnitTest
|
||||
{
|
||||
/** classpath location of ftl template for web script */
|
||||
@@ -81,12 +77,6 @@ public class HoldPutUnitTest extends BaseHoldWebScriptWithContentUnitTest
|
||||
/**
|
||||
* Test that a record can be removed from holds.
|
||||
*/
|
||||
|
||||
@Before
|
||||
public void setUp(){
|
||||
webScript.setHoldService(mockedHoldService);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void removeRecordFromHolds() throws Exception
|
||||
|
@@ -34,12 +34,11 @@ import static org.alfresco.service.cmr.security.PermissionService.GROUP_PREFIX;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anySet;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Matchers.anySet;
|
||||
import static org.mockito.Matchers.anyString;
|
||||
import static org.mockito.Matchers.eq;
|
||||
import static org.mockito.Mockito.doAnswer;
|
||||
import static org.mockito.Mockito.lenient;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.verify;
|
||||
@@ -76,11 +75,10 @@ import org.alfresco.service.namespace.RegexQNamePattern;
|
||||
import org.alfresco.service.transaction.TransactionService;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import org.mockito.invocation.InvocationOnMock;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
import org.mockito.stubbing.Answer;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.event.ContextRefreshedEvent;
|
||||
@@ -91,7 +89,6 @@ import org.springframework.context.event.ContextRefreshedEvent;
|
||||
* @author Roy Wetherall
|
||||
* @since 2.5
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class ExtendedSecurityServiceImplUnitTest
|
||||
{
|
||||
/** service mocks*/
|
||||
@@ -148,6 +145,9 @@ public class ExtendedSecurityServiceImplUnitTest
|
||||
@SuppressWarnings("unchecked")
|
||||
@Before public void before()
|
||||
{
|
||||
// initialise mocks
|
||||
MockitoAnnotations.initMocks(this);
|
||||
|
||||
// setup node
|
||||
nodeRef = AlfMock.generateNodeRef(mockedNodeService);
|
||||
|
||||
@@ -157,7 +157,7 @@ public class ExtendedSecurityServiceImplUnitTest
|
||||
.thenReturn(filePlan);
|
||||
|
||||
// set-up application context
|
||||
lenient().when(mockedApplicationContext.getBean("dbNodeService"))
|
||||
when(mockedApplicationContext.getBean("dbNodeService"))
|
||||
.thenReturn(mockedNodeService);
|
||||
|
||||
// setup retrying transaction helper
|
||||
@@ -199,7 +199,6 @@ public class ExtendedSecurityServiceImplUnitTest
|
||||
.forEach((a) ->
|
||||
when(mockedAuthorityService.authorityExists(a))
|
||||
.thenReturn(true));
|
||||
extendedSecurityService.setNodeService(mockedNodeService);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -482,7 +481,7 @@ public class ExtendedSecurityServiceImplUnitTest
|
||||
.thenReturn(mockedWritePagingResults);
|
||||
|
||||
// setup exact match
|
||||
lenient().when(mockedAuthorityService.authorityExists(GROUP_PREFIX + writeGroup))
|
||||
when(mockedAuthorityService.authorityExists(GROUP_PREFIX + writeGroup))
|
||||
.thenReturn(true);
|
||||
when(mockedAuthorityService.getContainedAuthorities(null, GROUP_PREFIX + readGroup, true))
|
||||
.thenReturn(Stream
|
||||
@@ -561,7 +560,7 @@ public class ExtendedSecurityServiceImplUnitTest
|
||||
.thenReturn(mockedWritePagingResults);
|
||||
|
||||
// setup exact match
|
||||
lenient().when(mockedAuthorityService.authorityExists(GROUP_PREFIX + writeGroup))
|
||||
when(mockedAuthorityService.authorityExists(GROUP_PREFIX + writeGroup))
|
||||
.thenReturn(true);
|
||||
when(mockedAuthorityService.getContainedAuthorities(null, GROUP_PREFIX + readGroup, true))
|
||||
.thenReturn(Stream
|
||||
@@ -652,7 +651,7 @@ public class ExtendedSecurityServiceImplUnitTest
|
||||
.thenReturn(mockedWritePagingResults);
|
||||
|
||||
// setup exact match
|
||||
lenient().when(mockedAuthorityService.authorityExists(GROUP_PREFIX + writeGroup))
|
||||
when(mockedAuthorityService.authorityExists(GROUP_PREFIX + writeGroup))
|
||||
.thenReturn(true);
|
||||
when(mockedAuthorityService.getContainedAuthorities(null, GROUP_PREFIX + readGroup, true))
|
||||
.thenReturn(Stream
|
||||
|
@@ -27,9 +27,8 @@
|
||||
|
||||
package org.alfresco.module.org_alfresco_module_rm.test.util;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Matchers.eq;
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.lenient;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.util.UUID;
|
||||
@@ -120,7 +119,7 @@ public class AlfMock
|
||||
public static NodeRef generateNodeRef(NodeService mockedNodeService, QName type, boolean exists)
|
||||
{
|
||||
NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, GUID.generate());
|
||||
lenient().when(mockedNodeService.exists(eq(nodeRef))).thenReturn(exists);
|
||||
when(mockedNodeService.exists(eq(nodeRef))).thenReturn(exists);
|
||||
if (type != null)
|
||||
{
|
||||
when(mockedNodeService.getType(eq(nodeRef))).thenReturn(type);
|
||||
|
@@ -28,10 +28,10 @@
|
||||
package org.alfresco.module.org_alfresco_module_rm.test.util;
|
||||
|
||||
import static org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock.generateQName;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Matchers.eq;
|
||||
import static org.mockito.Mockito.doAnswer;
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.lenient;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
@@ -168,7 +168,7 @@ public class BaseUnitTest implements RecordsManagementModel, ContentModel
|
||||
MockitoAnnotations.initMocks(this);
|
||||
|
||||
// setup application context
|
||||
lenient().doReturn(mockedNodeService).when(mockedApplicationContext).getBean("dbNodeService");
|
||||
doReturn(mockedNodeService).when(mockedApplicationContext).getBean("dbNodeService");
|
||||
|
||||
// setup retrying transaction helper
|
||||
Answer<Object> doInTransactionAnswer = new Answer<Object>()
|
||||
@@ -181,7 +181,7 @@ public class BaseUnitTest implements RecordsManagementModel, ContentModel
|
||||
return callback.execute();
|
||||
}
|
||||
};
|
||||
lenient().doAnswer(doInTransactionAnswer).when(mockedRetryingTransactionHelper).<Object>doInTransaction(any(RetryingTransactionCallback.class));
|
||||
doAnswer(doInTransactionAnswer).when(mockedRetryingTransactionHelper).<Object>doInTransaction(any(RetryingTransactionCallback.class));
|
||||
|
||||
// setup mocked authentication util
|
||||
MockAuthenticationUtilHelper.setup(mockedAuthenticationUtil);
|
||||
@@ -189,15 +189,15 @@ public class BaseUnitTest implements RecordsManagementModel, ContentModel
|
||||
// setup file plan
|
||||
filePlan = generateNodeRef(TYPE_FILE_PLAN);
|
||||
setupAsFilePlanComponent(filePlan);
|
||||
lenient().doReturn(true).when(mockedFilePlanService).isFilePlan(filePlan);
|
||||
doReturn(true).when(mockedFilePlanService).isFilePlan(filePlan);
|
||||
|
||||
// setup basic file plan component
|
||||
filePlanComponent = generateNodeRef();
|
||||
setupAsFilePlanComponent(filePlanComponent);
|
||||
|
||||
// setup namespace service
|
||||
lenient().doReturn(RM_URI).when(mockedNamespaceService).getNamespaceURI(RM_PREFIX);
|
||||
lenient().doReturn(CollectionUtils.unmodifiableSet(RM_PREFIX)).when(mockedNamespaceService).getPrefixes(RM_URI);
|
||||
doReturn(RM_URI).when(mockedNamespaceService).getNamespaceURI(RM_PREFIX);
|
||||
doReturn(CollectionUtils.unmodifiableSet(RM_PREFIX)).when(mockedNamespaceService).getPrefixes(RM_URI);
|
||||
|
||||
// setup record folder and record
|
||||
recordFolder = generateRecordFolder();
|
||||
@@ -206,10 +206,10 @@ public class BaseUnitTest implements RecordsManagementModel, ContentModel
|
||||
// set record as child of record folder
|
||||
List<ChildAssociationRef> result = new ArrayList<>(1);
|
||||
result.add(new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, recordFolder, generateQName(RM_URI), record, true, 1));
|
||||
lenient().doReturn(result).when(mockedNodeService).getChildAssocs(eq(recordFolder), eq(ContentModel.ASSOC_CONTAINS), any(QNamePattern.class));
|
||||
lenient().doReturn(result).when(mockedNodeService).getParentAssocs(record);
|
||||
lenient().doReturn(Collections.singletonList(recordFolder)).when(mockedRecordFolderService).getRecordFolders(record);
|
||||
lenient().doReturn(Collections.singletonList(record)).when(mockedRecordService).getRecords(recordFolder);
|
||||
doReturn(result).when(mockedNodeService).getChildAssocs(eq(recordFolder), eq(ContentModel.ASSOC_CONTAINS), any(QNamePattern.class));
|
||||
doReturn(result).when(mockedNodeService).getParentAssocs(record);
|
||||
doReturn(Collections.singletonList(recordFolder)).when(mockedRecordFolderService).getRecordFolders(record);
|
||||
doReturn(Collections.singletonList(record)).when(mockedRecordService).getRecords(recordFolder);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -221,7 +221,7 @@ public class BaseUnitTest implements RecordsManagementModel, ContentModel
|
||||
protected NodeRef generateHoldNodeRef(String name)
|
||||
{
|
||||
NodeRef hold = generateNodeRef(TYPE_HOLD);
|
||||
lenient().doReturn(name).when(mockedNodeService).getProperty(hold, ContentModel.PROP_NAME);
|
||||
doReturn(name).when(mockedNodeService).getProperty(hold, ContentModel.PROP_NAME);
|
||||
doReturn(true).when(mockedHoldService).isHold(hold);
|
||||
return hold;
|
||||
}
|
||||
@@ -235,7 +235,7 @@ public class BaseUnitTest implements RecordsManagementModel, ContentModel
|
||||
{
|
||||
NodeRef recordFolder = generateNodeRef(TYPE_RECORD_FOLDER);
|
||||
setupAsFilePlanComponent(recordFolder);
|
||||
lenient().doReturn(true).when(mockedRecordFolderService).isRecordFolder(recordFolder);
|
||||
doReturn(true).when(mockedRecordFolderService).isRecordFolder(recordFolder);
|
||||
return recordFolder;
|
||||
}
|
||||
|
||||
@@ -248,8 +248,8 @@ public class BaseUnitTest implements RecordsManagementModel, ContentModel
|
||||
{
|
||||
NodeRef record = generateNodeRef(ContentModel.TYPE_CONTENT);
|
||||
setupAsFilePlanComponent(record);
|
||||
lenient().doReturn(true).when(mockedNodeService).hasAspect(record, ASPECT_RECORD);
|
||||
lenient().doReturn(true).when(mockedRecordService).isRecord(record);
|
||||
doReturn(true).when(mockedNodeService).hasAspect(record, ASPECT_RECORD);
|
||||
doReturn(true).when(mockedRecordService).isRecord(record);
|
||||
return record;
|
||||
}
|
||||
|
||||
@@ -260,10 +260,10 @@ public class BaseUnitTest implements RecordsManagementModel, ContentModel
|
||||
*/
|
||||
protected void setupAsFilePlanComponent(NodeRef nodeRef)
|
||||
{
|
||||
lenient().doReturn(true).when(mockedNodeService).hasAspect(nodeRef, ASPECT_FILE_PLAN_COMPONENT);
|
||||
lenient().doReturn(true).when(mockedFilePlanService).isFilePlanComponent(nodeRef);
|
||||
lenient().doReturn(filePlan).when(mockedFilePlanService).getFilePlan(nodeRef);
|
||||
lenient().doReturn(filePlan).when(mockedNodeService).getProperty(nodeRef, PROP_ROOT_NODEREF);
|
||||
doReturn(true).when(mockedNodeService).hasAspect(nodeRef, ASPECT_FILE_PLAN_COMPONENT);
|
||||
doReturn(true).when(mockedFilePlanService).isFilePlanComponent(nodeRef);
|
||||
doReturn(filePlan).when(mockedFilePlanService).getFilePlan(nodeRef);
|
||||
doReturn(filePlan).when(mockedNodeService).getProperty(nodeRef, PROP_ROOT_NODEREF);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -297,7 +297,7 @@ public class BaseUnitTest implements RecordsManagementModel, ContentModel
|
||||
protected NodeRef generateCmContent(String name)
|
||||
{
|
||||
NodeRef nodeRef = generateNodeRef(ContentModel.TYPE_CONTENT, true);
|
||||
lenient().doReturn(name).when(mockedNodeService).getProperty(nodeRef, ContentModel.PROP_NAME);
|
||||
doReturn(name).when(mockedNodeService).getProperty(nodeRef, ContentModel.PROP_NAME);
|
||||
return nodeRef;
|
||||
}
|
||||
|
||||
@@ -312,11 +312,11 @@ public class BaseUnitTest implements RecordsManagementModel, ContentModel
|
||||
protected NodeRef generateNodeRef(QName type, boolean exists)
|
||||
{
|
||||
NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, GUID.generate());
|
||||
lenient().when(mockedNodeService.exists(eq(nodeRef))).thenReturn(exists);
|
||||
when(mockedNodeService.exists(eq(nodeRef))).thenReturn(exists);
|
||||
if (type != null)
|
||||
{
|
||||
lenient().when(mockedNodeService.getType(eq(nodeRef))).thenReturn(type);
|
||||
lenient().when(mockedNodeTypeUtility.instanceOf(type, type)).thenReturn(true);
|
||||
when(mockedNodeService.getType(eq(nodeRef))).thenReturn(type);
|
||||
when(mockedNodeTypeUtility.instanceOf(type, type)).thenReturn(true);
|
||||
}
|
||||
return nodeRef;
|
||||
}
|
||||
@@ -334,7 +334,7 @@ public class BaseUnitTest implements RecordsManagementModel, ContentModel
|
||||
|
||||
if (parent != null)
|
||||
{
|
||||
lenient().doReturn(parent).when(mockedChildAssociationRef).getParentRef();
|
||||
doReturn(parent).when(mockedChildAssociationRef).getParentRef();
|
||||
}
|
||||
|
||||
if (child != null)
|
||||
|
@@ -29,12 +29,10 @@ package org.alfresco.module.org_alfresco_module_rm.test.util;
|
||||
|
||||
import static java.util.Collections.emptyMap;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.nullable;
|
||||
import static org.mockito.Matchers.anyString;
|
||||
import static org.mockito.Matchers.eq;
|
||||
import static org.mockito.Mockito.doAnswer;
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.lenient;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
@@ -181,19 +179,19 @@ public abstract class BaseWebScriptUnitTest extends BaseUnitTest
|
||||
org.springframework.extensions.webscripts.Runtime mockedRuntime = mock(org.springframework.extensions.webscripts.Runtime.class);
|
||||
|
||||
WebScriptRequest mockedRequest = mock(WebScriptRequest.class);
|
||||
lenient().doReturn(match).when(mockedRequest).getServiceMatch();
|
||||
lenient().doReturn(mockedRuntime).when(mockedRequest).getRuntime();
|
||||
doReturn(match).when(mockedRequest).getServiceMatch();
|
||||
doReturn(mockedRuntime).when(mockedRequest).getRuntime();
|
||||
|
||||
if (content != null && !content.isEmpty())
|
||||
{
|
||||
Content mockedContent = mock(Content.class);
|
||||
lenient().doReturn(content).when(mockedContent).getContent();
|
||||
lenient().doReturn(mockedContent).when(mockedRequest).getContent();
|
||||
doReturn(content).when(mockedContent).getContent();
|
||||
doReturn(mockedContent).when(mockedRequest).getContent();
|
||||
}
|
||||
|
||||
String [] paramNames = (String[])parameters.keySet().toArray(new String[parameters.size()]);
|
||||
lenient().doReturn(paramNames).when(mockedRequest).getParameterNames();
|
||||
lenient().doAnswer(new Answer()
|
||||
doReturn(paramNames).when(mockedRequest).getParameterNames();
|
||||
doAnswer(new Answer()
|
||||
{
|
||||
@Override
|
||||
public Object answer(InvocationOnMock invocation) throws Throwable
|
||||
@@ -203,9 +201,9 @@ public abstract class BaseWebScriptUnitTest extends BaseUnitTest
|
||||
}
|
||||
|
||||
}).when(mockedRequest).getParameter(anyString());
|
||||
|
||||
lenient().doReturn(new String[0]).when(mockedRequest).getHeaderNames();
|
||||
lenient().doReturn("json").when(mockedRequest).getFormat();
|
||||
|
||||
doReturn(new String[0]).when(mockedRequest).getHeaderNames();
|
||||
doReturn("json").when(mockedRequest).getFormat();
|
||||
|
||||
return mockedRequest;
|
||||
}
|
||||
@@ -219,7 +217,7 @@ public abstract class BaseWebScriptUnitTest extends BaseUnitTest
|
||||
{
|
||||
WebScriptResponse mockedResponse = mock(WebScriptResponse.class);
|
||||
StringWriter writer = new StringWriter();
|
||||
lenient().doReturn(writer).when(mockedResponse).getWriter();
|
||||
doReturn(writer).when(mockedResponse).getWriter();
|
||||
return mockedResponse;
|
||||
}
|
||||
|
||||
@@ -232,13 +230,13 @@ public abstract class BaseWebScriptUnitTest extends BaseUnitTest
|
||||
protected Container getMockedContainer(String template) throws Exception
|
||||
{
|
||||
FormatRegistry mockedFormatRegistry = mock(FormatRegistry.class);
|
||||
lenient().doReturn("application/json").when(mockedFormatRegistry).getMimeType(nullable(String.class), nullable(String.class));
|
||||
doReturn("application/json").when(mockedFormatRegistry).getMimeType(anyString(), anyString());
|
||||
|
||||
ScriptProcessorRegistry mockedScriptProcessorRegistry = mock(ScriptProcessorRegistry.class);
|
||||
lenient().doReturn(null).when(mockedScriptProcessorRegistry).findValidScriptPath(anyString());
|
||||
doReturn(null).when(mockedScriptProcessorRegistry).findValidScriptPath(anyString());
|
||||
|
||||
TemplateProcessorRegistry mockedTemplateProcessorRegistry = mock(TemplateProcessorRegistry.class);
|
||||
lenient().doReturn(template).when(mockedTemplateProcessorRegistry).findValidTemplatePath(anyString());
|
||||
doReturn(template).when(mockedTemplateProcessorRegistry).findValidTemplatePath(anyString());
|
||||
|
||||
FTLTemplateProcessor ftlTemplateProcessor = new FTLTemplateProcessor()
|
||||
{
|
||||
@@ -250,25 +248,25 @@ public abstract class BaseWebScriptUnitTest extends BaseUnitTest
|
||||
};
|
||||
ftlTemplateProcessor.init();
|
||||
|
||||
lenient().doReturn(ftlTemplateProcessor).when(mockedTemplateProcessorRegistry).getTemplateProcessor(anyString());
|
||||
doReturn(ftlTemplateProcessor).when(mockedTemplateProcessorRegistry).getTemplateProcessor(anyString());
|
||||
|
||||
Container mockedContainer = mock(Container.class);
|
||||
lenient().doReturn(mockedFormatRegistry).when(mockedContainer).getFormatRegistry();
|
||||
lenient().doReturn(mockedScriptProcessorRegistry).when(mockedContainer).getScriptProcessorRegistry();
|
||||
lenient().doReturn(mockedTemplateProcessorRegistry).when(mockedContainer).getTemplateProcessorRegistry();
|
||||
doReturn(mockedFormatRegistry).when(mockedContainer).getFormatRegistry();
|
||||
doReturn(mockedScriptProcessorRegistry).when(mockedContainer).getScriptProcessorRegistry();
|
||||
doReturn(mockedTemplateProcessorRegistry).when(mockedContainer).getTemplateProcessorRegistry();
|
||||
|
||||
Map<String, Object> containerTemplateParameters = new HashMap<>(5);
|
||||
containerTemplateParameters.put("jsonUtils", new JSONUtils());
|
||||
containerTemplateParameters.put("people", getMockedPeopleObject());
|
||||
lenient().doReturn(containerTemplateParameters).when(mockedContainer).getTemplateParameters();
|
||||
doReturn(containerTemplateParameters).when(mockedContainer).getTemplateParameters();
|
||||
|
||||
SearchPath mockedSearchPath = mock(SearchPath.class);
|
||||
lenient().doReturn(false).when(mockedSearchPath).hasDocument(anyString());
|
||||
lenient().doReturn(mockedSearchPath).when(mockedContainer).getSearchPath();
|
||||
doReturn(false).when(mockedSearchPath).hasDocument(anyString());
|
||||
doReturn(mockedSearchPath).when(mockedContainer).getSearchPath();
|
||||
|
||||
// setup description
|
||||
Description mockDescription = mock(Description.class);
|
||||
lenient().doReturn(mock(RequiredCache.class)).when(mockDescription).getRequiredCache();
|
||||
doReturn(mock(RequiredCache.class)).when(mockDescription).getRequiredCache();
|
||||
|
||||
return mockedContainer;
|
||||
}
|
||||
|
@@ -27,10 +27,11 @@
|
||||
|
||||
package org.alfresco.module.org_alfresco_module_rm.test.util;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.Mockito.lenient;
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Matchers.anyString;
|
||||
import static org.mockito.Mockito.doAnswer;
|
||||
import static org.mockito.Mockito.reset;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
||||
@@ -73,7 +74,7 @@ public class MockAuthenticationUtilHelper
|
||||
reset(mockAuthenticationUtil);
|
||||
|
||||
// just do the work
|
||||
lenient().doAnswer(new Answer<Object>()
|
||||
doAnswer(new Answer<Object>()
|
||||
{
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
@@ -86,7 +87,7 @@ public class MockAuthenticationUtilHelper
|
||||
}).when(mockAuthenticationUtil).<Object> runAsSystem(any(RunAsWork.class));
|
||||
|
||||
// just do the work
|
||||
lenient().doAnswer(new Answer<Object>()
|
||||
doAnswer(new Answer<Object>()
|
||||
{
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
@@ -98,10 +99,10 @@ public class MockAuthenticationUtilHelper
|
||||
|
||||
}).when(mockAuthenticationUtil).<Object> runAs(any(RunAsWork.class), anyString());
|
||||
|
||||
lenient().when(mockAuthenticationUtil.getAdminUserName()).thenReturn(ADMIN_USER);
|
||||
lenient().when(mockAuthenticationUtil.getFullyAuthenticatedUser()).thenReturn(fullyAuthenticatedUser);
|
||||
lenient().when(mockAuthenticationUtil.getRunAsUser()).thenReturn(fullyAuthenticatedUser);
|
||||
lenient().when(mockAuthenticationUtil.getSystemUserName()).thenReturn(SYSTEM_USER);
|
||||
lenient().when(mockAuthenticationUtil.getGuestUserName()).thenReturn(GUEST_USER);
|
||||
when(mockAuthenticationUtil.getAdminUserName()).thenReturn(ADMIN_USER);
|
||||
when(mockAuthenticationUtil.getFullyAuthenticatedUser()).thenReturn(fullyAuthenticatedUser);
|
||||
when(mockAuthenticationUtil.getRunAsUser()).thenReturn(fullyAuthenticatedUser);
|
||||
when(mockAuthenticationUtil.getSystemUserName()).thenReturn(SYSTEM_USER);
|
||||
when(mockAuthenticationUtil.getGuestUserName()).thenReturn(GUEST_USER);
|
||||
}
|
||||
}
|
||||
|
@@ -87,7 +87,6 @@ public class ContentBinDuplicationUtilityUnitTest
|
||||
public void setUp()
|
||||
{
|
||||
MockitoAnnotations.initMocks(this);
|
||||
contentBinDuplicationUtility.setNodeService(mockNodeService);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -29,11 +29,10 @@ package org.alfresco.module.org_alfresco_module_rm.version;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyMap;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.ArgumentMatchers.nullable;
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Matchers.anyMap;
|
||||
import static org.mockito.Matchers.anyString;
|
||||
import static org.mockito.Matchers.eq;
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.never;
|
||||
@@ -53,6 +52,7 @@ import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest;
|
||||
import org.alfresco.repo.version.Version2Model;
|
||||
import org.alfresco.repo.version.VersionModel;
|
||||
import org.alfresco.repo.version.common.VersionImpl;
|
||||
import org.alfresco.service.cmr.model.FileInfo;
|
||||
import org.alfresco.service.cmr.repository.ContentReader;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
@@ -61,11 +61,9 @@ import org.alfresco.service.cmr.version.VersionType;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.Spy;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
|
||||
/**
|
||||
* Recordable version service implementation unit test.
|
||||
@@ -73,7 +71,6 @@ import org.mockito.junit.MockitoJUnitRunner;
|
||||
* @author Roy Wetherall
|
||||
* @since 2.3
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class RecordableVersionServiceImplUnitTest extends BaseUnitTest
|
||||
{
|
||||
/** versioned content name */
|
||||
@@ -111,23 +108,34 @@ public class RecordableVersionServiceImplUnitTest extends BaseUnitTest
|
||||
recordableVersionService.initialise();
|
||||
|
||||
doReturn(generateChildAssociationRef(null, generateNodeRef(Version2Model.TYPE_QNAME_VERSION_HISTORY)))
|
||||
.when(mockedDbNodeService).createNode(nullable(NodeRef.class),
|
||||
nullable(QName.class),
|
||||
nullable(QName.class),
|
||||
.when(mockedDbNodeService).createNode(any(NodeRef.class),
|
||||
any(QName.class),
|
||||
any(QName.class),
|
||||
eq(Version2Model.TYPE_QNAME_VERSION_HISTORY),
|
||||
nullable(Map.class));
|
||||
anyMap());
|
||||
doReturn(generateChildAssociationRef(null, generateNodeRef(TYPE_CONTENT)))
|
||||
.when(mockedDbNodeService).createNode(any(NodeRef.class),
|
||||
any(QName.class),
|
||||
any(QName.class),
|
||||
eq(TYPE_CONTENT),
|
||||
anyMap());
|
||||
|
||||
doReturn(filePlan).when(mockedFilePlanService).getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID);
|
||||
doReturn(unfiledRecordContainer).when(mockedFilePlanService).getUnfiledContainer(any(NodeRef.class));
|
||||
|
||||
record = generateCmContent(CONTENT_NAME);
|
||||
FileInfo mockedFileInfo = mock(FileInfo.class);
|
||||
doReturn(record).when(mockedFileInfo).getNodeRef();
|
||||
doReturn(mockedFileInfo).when(mockedFileFolderService).copy(any(NodeRef.class),
|
||||
any(NodeRef.class),
|
||||
any(String.class));
|
||||
version = generateNodeRef(TYPE_CONTENT);
|
||||
doReturn(generateChildAssociationRef(null, version)).when(mockedDbNodeService).createNode(
|
||||
nullable(NodeRef.class),
|
||||
any(NodeRef.class),
|
||||
eq(Version2Model.CHILD_QNAME_VERSIONS),
|
||||
nullable(QName.class),
|
||||
any(QName.class),
|
||||
eq(TYPE_CONTENT),
|
||||
nullable(Map.class));
|
||||
recordableVersionService.setDbNodeService(mockedDbNodeService);
|
||||
anyMap());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -159,6 +167,7 @@ public class RecordableVersionServiceImplUnitTest extends BaseUnitTest
|
||||
{
|
||||
// setup given conditions
|
||||
doReturn(false).when(mockedNodeService).hasAspect(nodeRef, RecordableVersionModel.ASPECT_VERSIONABLE);
|
||||
doReturn(null).when(mockedNodeService).getProperty(nodeRef, RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY);
|
||||
versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR);
|
||||
|
||||
// when version is created
|
||||
@@ -348,6 +357,7 @@ public class RecordableVersionServiceImplUnitTest extends BaseUnitTest
|
||||
public void filePlanSpecifiedNoPolicy() throws Exception
|
||||
{
|
||||
// setup given conditions
|
||||
doReturn(true).when(mockedNodeService).hasAspect(nodeRef, RecordableVersionModel.ASPECT_VERSIONABLE);
|
||||
versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MAJOR);
|
||||
versionProperties.put(RecordableVersionServiceImpl.KEY_RECORDABLE_VERSION, true);
|
||||
|
||||
@@ -366,6 +376,7 @@ public class RecordableVersionServiceImplUnitTest extends BaseUnitTest
|
||||
public void adHocRecordedVersionNoPolicy() throws Exception
|
||||
{
|
||||
// setup given conditions
|
||||
doReturn(true).when(mockedNodeService).hasAspect(nodeRef, RecordableVersionModel.ASPECT_VERSIONABLE);
|
||||
versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MAJOR);
|
||||
versionProperties.put(RecordableVersionServiceImpl.KEY_RECORDABLE_VERSION, true);
|
||||
|
||||
@@ -380,6 +391,8 @@ public class RecordableVersionServiceImplUnitTest extends BaseUnitTest
|
||||
public void adHocRecordedVersionOverridePolicy() throws Exception
|
||||
{
|
||||
// setup given conditions
|
||||
doReturn(true).when(mockedNodeService).hasAspect(nodeRef, RecordableVersionModel.ASPECT_VERSIONABLE);
|
||||
doReturn(RecordableVersionPolicy.MAJOR_ONLY.toString()).when(mockedNodeService).getProperty(nodeRef, RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY);
|
||||
versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR);
|
||||
versionProperties.put(RecordableVersionServiceImpl.KEY_RECORDABLE_VERSION, true);
|
||||
|
||||
@@ -448,15 +461,16 @@ public class RecordableVersionServiceImplUnitTest extends BaseUnitTest
|
||||
// latest version is not recorded
|
||||
Version mockedVersion = mock(VersionImpl.class);
|
||||
NodeRef versionNodeRef = generateNodeRef();
|
||||
doReturn(Collections.emptyMap()).when(mockedVersion).getVersionProperties();
|
||||
doReturn(true).when(mockedNodeService).hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE);
|
||||
|
||||
// version history
|
||||
NodeRef versionHistoryNodeRef = generateNodeRef();
|
||||
doReturn(versionHistoryNodeRef).when(mockedDbNodeService).getChildByName(nullable(NodeRef.class), eq(Version2Model.CHILD_QNAME_VERSION_HISTORIES), nullable(String.class));
|
||||
doReturn(versionHistoryNodeRef).when(mockedDbNodeService).getChildByName(any(NodeRef.class), eq(Version2Model.CHILD_QNAME_VERSION_HISTORIES), any(String.class));
|
||||
|
||||
// version number
|
||||
doReturn(mockedVersion).when(recordableVersionService).getCurrentVersion(nodeRef);
|
||||
doReturn(versionNodeRef).when(recordableVersionService).convertNodeRef(nullable(NodeRef.class));
|
||||
doReturn(versionNodeRef).when(recordableVersionService).convertNodeRef(any(NodeRef.class));
|
||||
makePrimaryParentOf(versionNodeRef, versionHistoryNodeRef, ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "something-0"), mockedDbNodeService);
|
||||
|
||||
// created version
|
||||
@@ -464,36 +478,36 @@ public class RecordableVersionServiceImplUnitTest extends BaseUnitTest
|
||||
doReturn(generateChildAssociationRef(versionHistoryNodeRef, newVersionNodeRef)).when(mockedDbNodeService).createNode(
|
||||
eq(versionHistoryNodeRef),
|
||||
eq(Version2Model.CHILD_QNAME_VERSIONS),
|
||||
nullable(QName.class),
|
||||
nullable(QName.class),
|
||||
nullable(Map.class));
|
||||
any(QName.class),
|
||||
any(QName.class),
|
||||
any(Map.class));
|
||||
|
||||
// created record
|
||||
NodeRef newRecordNodeRef = generateNodeRef();
|
||||
doReturn(newRecordNodeRef).when(mockedRecordService).createRecordFromContent(
|
||||
eq(filePlan),
|
||||
nullable(String.class),
|
||||
nullable(QName.class),
|
||||
nullable(Map.class),
|
||||
nullable(ContentReader.class));
|
||||
eq(filePlan),
|
||||
any(String.class),
|
||||
any(QName.class),
|
||||
any(Map.class),
|
||||
any(ContentReader.class));
|
||||
|
||||
// create record from version
|
||||
recordableVersionService.createRecordFromLatestVersion(filePlan, nodeRef);
|
||||
|
||||
// verify that the version is converted to a recorded version
|
||||
verify(mockedRecordService, times(1)).createRecordFromContent(
|
||||
eq(filePlan),
|
||||
nullable(String.class),
|
||||
nullable(QName.class),
|
||||
any(Map.class),
|
||||
nullable(ContentReader.class));
|
||||
eq(filePlan),
|
||||
any(String.class),
|
||||
any(QName.class),
|
||||
any(Map.class),
|
||||
any(ContentReader.class));
|
||||
verify(mockedDbNodeService, times(1)).deleteNode(any(NodeRef.class));
|
||||
verify(mockedDbNodeService, times(1)).createNode(
|
||||
eq(versionHistoryNodeRef),
|
||||
eq(Version2Model.CHILD_QNAME_VERSIONS),
|
||||
nullable(QName.class),
|
||||
nullable(QName.class),
|
||||
nullable(Map.class));
|
||||
any(QName.class),
|
||||
any(QName.class),
|
||||
any(Map.class));
|
||||
verify(mockedNodeService, times(1)).addAspect(eq(newVersionNodeRef), eq(Version2Model.ASPECT_VERSION), any(Map.class));
|
||||
verify(mockedNodeService, times(1)).addAspect(
|
||||
newVersionNodeRef,
|
||||
@@ -591,13 +605,20 @@ public class RecordableVersionServiceImplUnitTest extends BaseUnitTest
|
||||
// set up version
|
||||
Version mockedVersion = mock(VersionImpl.class);
|
||||
NodeRef versionNodeRef = generateNodeRef();
|
||||
NodeRef versionRecordNodeRef = generateNodeRef();
|
||||
when(mockedVersion.getFrozenStateNodeRef())
|
||||
.thenReturn(versionNodeRef);
|
||||
|
||||
when(mockedDbNodeService.exists(versionRecordNodeRef))
|
||||
.thenReturn(true);
|
||||
|
||||
// indicate that the version doesn't have the aspect
|
||||
when(mockedDbNodeService.hasAspect(versionNodeRef, RecordableVersionModel.ASPECT_RECORDED_VERSION))
|
||||
.thenReturn(true);
|
||||
|
||||
// indicate that the associated version record exists
|
||||
when(mockedDbNodeService.getProperty(versionNodeRef, RecordableVersionModel.PROP_RECORD_NODE_REF))
|
||||
.thenReturn(versionRecordNodeRef);
|
||||
|
||||
// mark as destroyed
|
||||
recordableVersionService.destroyRecordedVersion(mockedVersion);
|
||||
|
||||
@@ -622,13 +643,20 @@ public class RecordableVersionServiceImplUnitTest extends BaseUnitTest
|
||||
// set up version
|
||||
Version mockedVersion = mock(VersionImpl.class);
|
||||
NodeRef versionNodeRef = generateNodeRef();
|
||||
NodeRef versionRecordNodeRef = generateNodeRef();
|
||||
when(mockedVersion.getFrozenStateNodeRef())
|
||||
.thenReturn(versionNodeRef);
|
||||
|
||||
when(mockedDbNodeService.exists(versionRecordNodeRef))
|
||||
.thenReturn(false);
|
||||
|
||||
// indicate that the version doesn't have the aspect
|
||||
when(mockedDbNodeService.hasAspect(versionNodeRef, RecordableVersionModel.ASPECT_RECORDED_VERSION))
|
||||
.thenReturn(true);
|
||||
|
||||
// indicate that the associated version record exists
|
||||
when(mockedDbNodeService.getProperty(versionNodeRef, RecordableVersionModel.PROP_RECORD_NODE_REF))
|
||||
.thenReturn(versionRecordNodeRef);
|
||||
|
||||
// mark as destroyed
|
||||
recordableVersionService.destroyRecordedVersion(mockedVersion);
|
||||
|
||||
|
@@ -33,11 +33,10 @@ import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyBoolean;
|
||||
import static org.mockito.ArgumentMatchers.anyLong;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.ArgumentMatchers.nullable;
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Matchers.anyBoolean;
|
||||
import static org.mockito.Matchers.anyLong;
|
||||
import static org.mockito.Matchers.eq;
|
||||
import static org.mockito.Mockito.doAnswer;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.never;
|
||||
@@ -563,7 +562,7 @@ public class DynamicAuthoritiesGetUnitTest extends BaseWebScriptUnitTest impleme
|
||||
executeWebScript(parameters);
|
||||
|
||||
verify(contentStreamer, times(1)).streamContent(any(WebScriptRequest.class), any(WebScriptResponse.class),
|
||||
csvFileCaptor.capture(), nullable(Long.class), any(Boolean.class), any(String.class), any(Map.class));
|
||||
csvFileCaptor.capture(), any(Long.class), any(Boolean.class), any(String.class), any(Map.class));
|
||||
|
||||
File fileForDownload = csvFileCaptor.getValue();
|
||||
assertNotNull(fileForDownload);
|
||||
|
@@ -28,9 +28,8 @@
|
||||
package org.alfresco.rm.rest.api.impl;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.ArgumentMatchers.nullable;
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Matchers.eq;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.times;
|
||||
@@ -42,6 +41,7 @@ import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model;
|
||||
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
||||
import org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock;
|
||||
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.rest.api.impl.SiteImportPackageHandler;
|
||||
import org.alfresco.rest.api.model.Site;
|
||||
import org.alfresco.rest.api.model.SiteUpdate;
|
||||
@@ -59,11 +59,10 @@ import org.alfresco.service.cmr.view.Location;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
|
||||
/**
|
||||
* Unit Test class for RMSitesImpl.
|
||||
@@ -72,7 +71,6 @@ import org.mockito.junit.MockitoJUnitRunner;
|
||||
* @since 2.6
|
||||
*
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class RMSitesImplUnitTest extends BaseUnitTest
|
||||
{
|
||||
private static final String RM_SITE_TITLE_AFTER_UPDATE = "Updated Title";
|
||||
@@ -88,6 +86,8 @@ public class RMSitesImplUnitTest extends BaseUnitTest
|
||||
@Mock
|
||||
private SiteService mockedSiteService;
|
||||
@Mock
|
||||
AuthenticationUtil mockAuthenticationUtil;
|
||||
@Mock
|
||||
private ImporterService mockedImporterService;
|
||||
@Mock
|
||||
private FavouritesService mockedFavouritesService;
|
||||
@@ -95,6 +95,7 @@ public class RMSitesImplUnitTest extends BaseUnitTest
|
||||
@Before
|
||||
public void before()
|
||||
{
|
||||
MockitoAnnotations.initMocks(this);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -137,7 +138,7 @@ public class RMSitesImplUnitTest extends BaseUnitTest
|
||||
|
||||
verify(mockedImporterService, times(1)).importView(any(SiteImportPackageHandler.class), any(Location.class), any(ImporterBinding.class), eq(null));
|
||||
verify(mockedSiteService, times(1)).createContainer(RM_SITE_ID, SiteService.DOCUMENT_LIBRARY, ContentModel.TYPE_FOLDER, null);
|
||||
verify(mockedFavouritesService, times(1)).addFavourite(nullable(String.class), any(NodeRef.class));
|
||||
verify(mockedFavouritesService, times(1)).addFavourite(any(String.class), any(NodeRef.class));
|
||||
|
||||
//verify returned values for RM site are the right ones
|
||||
assertEquals(RMSiteCompliance.STANDARD, createdRMSite.getCompliance());
|
||||
@@ -190,7 +191,7 @@ public class RMSitesImplUnitTest extends BaseUnitTest
|
||||
|
||||
verify(mockedImporterService, times(1)).importView(any(SiteImportPackageHandler.class), any(Location.class), any(ImporterBinding.class), eq(null));
|
||||
verify(mockedSiteService, times(1)).createContainer(RM_SITE_ID, SiteService.DOCUMENT_LIBRARY, ContentModel.TYPE_FOLDER, null);
|
||||
verify(mockedFavouritesService, times(1)).addFavourite(nullable(String.class), any(NodeRef.class));
|
||||
verify(mockedFavouritesService, times(1)).addFavourite(any(String.class), any(NodeRef.class));
|
||||
|
||||
//verify returned values for RM site are the right ones
|
||||
assertEquals(RMSiteCompliance.DOD5015, createdRMSite.getCompliance());
|
||||
@@ -252,12 +253,13 @@ public class RMSitesImplUnitTest extends BaseUnitTest
|
||||
when(mockedNodeService.getType(siteNodeRef)).thenReturn(RecordsManagementModel.TYPE_RM_SITE);
|
||||
|
||||
when(mockedSiteService.getSite(siteId)).thenReturn(mockedSiteInfo);
|
||||
when(mockedSiteService.getMembersRole(eq(siteId), nullable(String.class))).thenReturn(RM_SITE_MANAGER_ROLE);
|
||||
when(mockedSiteService.getMembersRole(eq(siteId), any(String.class))).thenReturn(RM_SITE_MANAGER_ROLE);
|
||||
|
||||
//mock UpdateSite
|
||||
SiteUpdate mockedSiteUpdate= mock(SiteUpdate.class);
|
||||
when(mockedSiteUpdate.getDescription()).thenReturn(RM_SITE_DESCRIPTION_AFTER_UPDATE);
|
||||
when(mockedSiteUpdate.getTitle()).thenReturn(RM_SITE_TITLE_AFTER_UPDATE);
|
||||
when(mockedSiteUpdate.getVisibility()).thenReturn(null);
|
||||
when(mockedSiteUpdate.wasSet(Site.TITLE)).thenReturn(true);
|
||||
when(mockedSiteUpdate.wasSet(Site.DESCRIPTION)).thenReturn(true);
|
||||
|
||||
@@ -307,7 +309,7 @@ public class RMSitesImplUnitTest extends BaseUnitTest
|
||||
when(mockedNodeService.getType(siteNodeRef)).thenReturn(RecordsManagementModel.TYPE_RM_SITE);
|
||||
|
||||
when(mockedSiteService.getSite(siteId)).thenReturn(mockedSiteInfo);
|
||||
when(mockedSiteService.getMembersRole(eq(siteId), nullable(String.class))).thenReturn(RM_SITE_MANAGER_ROLE);
|
||||
when(mockedSiteService.getMembersRole(eq(siteId), any(String.class))).thenReturn(RM_SITE_MANAGER_ROLE);
|
||||
|
||||
//STANDARD compliance
|
||||
RMSite rmSite = rmSitesImpl.getRMSite(siteId);
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-governance-services-community-repo-parent</artifactId>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
<version>12.10</version>
|
||||
</parent>
|
||||
|
||||
<build>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
<version>12.10</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -8,7 +8,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-amps</artifactId>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
<version>12.10</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
<version>12.10</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
<version>12.10</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
@@ -26,7 +26,6 @@
|
||||
package org.alfresco.repo.content;
|
||||
|
||||
import org.alfresco.api.AlfrescoPublicApi;
|
||||
import org.alfresco.service.Experimental;
|
||||
import org.alfresco.service.cmr.repository.ContentAccessor;
|
||||
import org.alfresco.service.cmr.repository.ContentIOException;
|
||||
import org.alfresco.service.cmr.repository.ContentReader;
|
||||
@@ -34,9 +33,6 @@ import org.alfresco.service.cmr.repository.ContentStreamListener;
|
||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||
import org.alfresco.service.cmr.repository.DirectAccessUrl;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* Provides low-level retrieval of content
|
||||
@@ -273,25 +269,9 @@ public interface ContentStore
|
||||
* @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(String contentUrl, boolean attachment, String fileName)
|
||||
{
|
||||
return requestContentDirectUrl(contentUrl, attachment, fileName, null, 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 contentUrl A content store {@code URL}
|
||||
* @param attachment {@code true} if an attachment URL is requested, {@code false} for an embedded {@code URL}.
|
||||
* @param fileName File name of the content
|
||||
* @return A direct access {@code URL} object for the content
|
||||
* @throws UnsupportedOperationException if the store is unable to provide the information
|
||||
*/
|
||||
default DirectAccessUrl requestContentDirectUrl(String contentUrl, boolean attachment, String fileName, String mimetype)
|
||||
{
|
||||
return requestContentDirectUrl(contentUrl, attachment, fileName, mimetype, null);
|
||||
return requestContentDirectUrl(contentUrl, attachment, fileName, null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -305,43 +285,9 @@ public interface ContentStore
|
||||
* @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(String contentUrl, boolean attachment, String fileName, Long validFor)
|
||||
{
|
||||
return requestContentDirectUrl(contentUrl, attachment, fileName, null, 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 contentUrl A content store {@code URL}
|
||||
* @param attachment {@code true} if an attachment URL is requested, {@code false} for an embedded {@code URL}.
|
||||
* @param fileName File name of the content
|
||||
* @param mimetype Mimetype of the content
|
||||
* @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
|
||||
*/
|
||||
default DirectAccessUrl requestContentDirectUrl(String contentUrl, boolean attachment, String fileName, String mimetype, Long validFor)
|
||||
{
|
||||
throw new UnsupportedOperationException(
|
||||
"Retrieving direct access URLs is not supported by this content store.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a key-value (String-String) collection of storage headers/properties with their respective values.
|
||||
* A particular Cloud Connector will fill in that data with Cloud Storage Provider generic data.
|
||||
* Map may be also filled in with entries consisting of pre-defined Alfresco keys of {@code ObjectStorageProps} and their values.
|
||||
* If empty Map is returned - no connector is present or connector is not supporting retrieval of the properties
|
||||
* or cannot determine the properties.
|
||||
*
|
||||
* @param contentUrl the URL of the content for which the storage properties are to be retrieved.
|
||||
* @return Returns a key-value (String-String) collection of storage headers/properties with their respective values.
|
||||
*/
|
||||
@Experimental
|
||||
default Map<String, String> getStorageProperties(String contentUrl)
|
||||
{
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
}
|
||||
|
@@ -1,64 +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.repo.content;
|
||||
|
||||
import org.alfresco.service.Experimental;
|
||||
|
||||
/**
|
||||
* Enumeration with "header" values for Alfresco derived Storage Properties
|
||||
* Values of this enum should be used when adding Alfresco derived key-value pairs in Storage Properties map.
|
||||
* Subject to expand/change.
|
||||
*
|
||||
* @author mpichura
|
||||
*/
|
||||
@Experimental
|
||||
public enum ObjectStorageProps {
|
||||
/**
|
||||
* Object's content is archived and not immediately accessible.
|
||||
*/
|
||||
X_ALF_ARCHIVED("x-alf-archived"),
|
||||
/**
|
||||
* Object's content retrieval from archive is in progress
|
||||
*/
|
||||
X_ALF_ARCHIVE_RESTORE_IN_PROGRESS("x-alf-archive-restore-in-progress"),
|
||||
/**
|
||||
* Expiry date and time of object's content retrieved from archive.
|
||||
* Use YYYYMMDDThhmmssZ (ISO-8601) datetime format when using this value as key in Storage Properties map.
|
||||
*/
|
||||
X_ALF_ARCHIVE_RESTORE_EXPIRY("x-alf-archive-restore-expiry");
|
||||
|
||||
ObjectStorageProps(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
private final String value;
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
}
|
@@ -1,55 +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;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Annotation to mark a type/method/field as experimental.
|
||||
* <p>
|
||||
* If this annotation is present on an element it marks it as experimental and subject to change without further notice.
|
||||
* The element may even be deleted or renamed without any notice.
|
||||
* Experimental element may likely become a valid one (not experimental anymore) in future releases but there is no guarantee when
|
||||
* and if that happens.
|
||||
*
|
||||
* @author mpichura
|
||||
*/
|
||||
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.TYPE})
|
||||
@Retention(RetentionPolicy.CLASS)
|
||||
@Documented
|
||||
public @interface Experimental {
|
||||
/**
|
||||
* Further description that can optionally be added to clarify possible future changes of annotated object.
|
||||
*
|
||||
* @return a String, the default is an empty String.
|
||||
*/
|
||||
String description() default "";
|
||||
|
||||
}
|
112
mmt/pom.xml
112
mmt/pom.xml
@@ -1,112 +0,0 @@
|
||||
<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/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>alfresco-mmt</artifactId>
|
||||
<name>Alfresco Module Management Tool</name>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-repository</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>de.schlichtherle.truezip</groupId>
|
||||
<artifactId>truezip-driver-zip</artifactId>
|
||||
<version>${dependency.truezip.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>de.schlichtherle.truezip</groupId>
|
||||
<artifactId>truezip-file</artifactId>
|
||||
<version>${dependency.truezip.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-artifact</artifactId>
|
||||
<version>${dependency.maven-artifact.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>make-mmt</id>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<transformers>
|
||||
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
|
||||
<manifestEntries>
|
||||
<Main-Class>org.alfresco.repo.module.tool.ModuleManagementTool</Main-Class>
|
||||
</manifestEntries>
|
||||
</transformer>
|
||||
</transformers>
|
||||
<artifactSet>
|
||||
<includes>
|
||||
<include>de.schlichtherle.truezip:*</include>
|
||||
<include>org.alfresco:alfresco-core</include>
|
||||
<include>org.alfresco:alfresco-repository</include>
|
||||
<include>org.apache.commons:commons-compress</include>
|
||||
<include>org.safehaus.jug:jug</include>
|
||||
<include>org.alfresco.surf:spring-surf-core</include>
|
||||
<include>org.tukaani:xz</include>
|
||||
<include>org.apache.maven:maven-artifact</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
<filters>
|
||||
<filter>
|
||||
<artifact>org.alfresco:alfresco-core</artifact>
|
||||
<includes>
|
||||
<include>org/alfresco/error/AlfrescoRuntimeException.class</include>
|
||||
<include>org/alfresco/util/Pair.class</include>
|
||||
<include>org/alfresco/util/EqualsHelper.class</include>
|
||||
<include>org/alfresco/util/VersionNumber.class</include>
|
||||
</includes>
|
||||
</filter>
|
||||
<filter>
|
||||
<artifact>org.apache.maven:maven-artifact</artifact>
|
||||
<includes>
|
||||
<include>org/apache/maven/artifact/versioning/**/*.class</include>
|
||||
</includes>
|
||||
</filter>
|
||||
<filter>
|
||||
<artifact>org.alfresco:alfresco-repository</artifact>
|
||||
<includes>
|
||||
<include>org/alfresco/repo/module/tool/default-file-mapping.properties</include>
|
||||
<include>org/alfresco/repo/module/**/*.class</include>
|
||||
<include>org/alfresco/service/cmr/module/**/*.class</include>
|
||||
</includes>
|
||||
</filter>
|
||||
<filter>
|
||||
<artifact>org.alfresco.surf:spring-surf-core</artifact>
|
||||
<includes>
|
||||
<include>org/springframework/extensions/surf/util/I18NUtil.class</include>
|
||||
<include>org/springframework/extensions/surf/util/ISO8601DateFormat.class</include>
|
||||
<include>org/springframework/extensions/surf/exception/PlatformRuntimeException.class</include>
|
||||
</includes>
|
||||
</filter>
|
||||
<filter>
|
||||
<!-- Duplicated file in truezip-driver-file, need to filter this one -->
|
||||
<artifact>de.schlichtherle.truezip:truezip-driver-zip</artifact>
|
||||
<excludes>
|
||||
<exclude>META-INF/services/de.schlichtherle.truezip.fs.spi.FsDriverService</exclude>
|
||||
</excludes>
|
||||
</filter>
|
||||
</filters>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
@@ -1,165 +0,0 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
@@ -9,6 +9,6 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
<version>12.10</version>
|
||||
</parent>
|
||||
</project>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
<version>12.10</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
@@ -71,7 +71,6 @@
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-mmt</artifactId>
|
||||
<type>jar</type>
|
||||
<version>${project.version}</version>
|
||||
<overWrite>false</overWrite>
|
||||
<outputDirectory>${project.build.directory}/alfresco-mmt</outputDirectory>
|
||||
</artifactItem>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
<version>12.10</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
<version>12.10</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
<version>12.10</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
<version>12.10</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
<version>12.10</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
@@ -93,7 +93,7 @@
|
||||
<dependency>
|
||||
<groupId>com.jayway.jsonpath</groupId>
|
||||
<artifactId>json-path</artifactId>
|
||||
<version>${dependency.jakarta-json-path.version}</version>
|
||||
<version>2.5.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
<version>12.10</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
<version>12.10</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -198,4 +198,15 @@ 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.28-SNAPSHOT</version>
|
||||
<version>12.10</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#%L
|
||||
Alfresco Repository WAR Community
|
||||
%%
|
||||
Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
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
|
||||
@@ -35,15 +35,6 @@
|
||||
<%@ 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");
|
||||
|
56
pom.xml
56
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.28-SNAPSHOT</version>
|
||||
<version>12.10</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>Alfresco Community Repo Parent</name>
|
||||
|
||||
@@ -12,21 +12,19 @@
|
||||
<version>12</version>
|
||||
</parent>
|
||||
|
||||
|
||||
<modules>
|
||||
<module>core</module>
|
||||
<module>data-model</module>
|
||||
<module>repository</module>
|
||||
<module>remote-api</module>
|
||||
<module>mmt</module>
|
||||
<module>packaging</module>
|
||||
<module>amps</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<acs.version.major>7</acs.version.major>
|
||||
<acs.version.minor>2</acs.version.minor>
|
||||
<acs.version.revision>0</acs.version.revision>
|
||||
<acs.version.minor>1</acs.version.minor>
|
||||
<acs.version.revision>1</acs.version.revision>
|
||||
<acs.version.label />
|
||||
<amp.min.version>${acs.version.major}.0.0</amp.min.version>
|
||||
|
||||
@@ -45,6 +43,7 @@
|
||||
<dir.root>${project.build.directory}/alf_data</dir.root>
|
||||
|
||||
<dependency.alfresco-hb-data-sender.version>1.0.12</dependency.alfresco-hb-data-sender.version>
|
||||
<dependency.alfresco-mmt.version>6.0</dependency.alfresco-mmt.version>
|
||||
<dependency.alfresco-trashcan-cleaner.version>2.4.1</dependency.alfresco-trashcan-cleaner.version>
|
||||
<dependency.alfresco-jlan.version>7.1</dependency.alfresco-jlan.version>
|
||||
<dependency.alfresco-server-root.version>6.0.1</dependency.alfresco-server-root.version>
|
||||
@@ -56,15 +55,16 @@
|
||||
<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.10</dependency.spring.version>
|
||||
<dependency.spring.version>5.3.9</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.cxf.version>3.4.4</dependency.cxf.version>
|
||||
<dependency.opencmis.version>1.0.0</dependency.opencmis.version>
|
||||
<dependency.webscripts.version>8.24</dependency.webscripts.version>
|
||||
<dependency.webscripts.version>8.26</dependency.webscripts.version>
|
||||
<dependency.bouncycastle.version>1.69</dependency.bouncycastle.version>
|
||||
<dependency.mockito-core.version>3.11.2</dependency.mockito-core.version>
|
||||
<dependency.mockito-all.version>1.10.19</dependency.mockito-all.version>
|
||||
<dependency.org-json.version>20210307</dependency.org-json.version>
|
||||
<dependency.commons-dbcp.version>1.4-DBCP330</dependency.commons-dbcp.version>
|
||||
<dependency.commons-io.version>2.11.0</dependency.commons-io.version>
|
||||
@@ -73,15 +73,15 @@
|
||||
<dependency.httpcore.version>4.4.14</dependency.httpcore.version>
|
||||
<dependency.commons-httpclient.version>3.1-HTTPCLIENT-1265</dependency.commons-httpclient.version>
|
||||
<dependency.xercesImpl.version>2.12.1</dependency.xercesImpl.version>
|
||||
<dependency.slf4j.version>1.7.32</dependency.slf4j.version>
|
||||
<dependency.slf4j.version>1.7.30</dependency.slf4j.version>
|
||||
<dependency.gytheio.version>0.12</dependency.gytheio.version>
|
||||
<dependency.groovy.version>3.0.9</dependency.groovy.version>
|
||||
<dependency.groovy.version>2.5.9</dependency.groovy.version>
|
||||
<dependency.tika.version>1.27</dependency.tika.version>
|
||||
<dependency.spring-security.version>5.5.2</dependency.spring-security.version>
|
||||
<dependency.spring-security.version>5.5.1</dependency.spring-security.version>
|
||||
<dependency.truezip.version>7.7.10</dependency.truezip.version>
|
||||
<dependency.poi.version>4.1.2</dependency.poi.version>
|
||||
<dependency.ooxml-schemas.version>1.4</dependency.ooxml-schemas.version>
|
||||
<dependency.keycloak.version>15.0.2</dependency.keycloak.version>
|
||||
<dependency.keycloak.version>13.0.1</dependency.keycloak.version>
|
||||
<dependency.jboss.logging.version>3.4.2.Final</dependency.jboss.logging.version>
|
||||
<dependency.camel.version>3.7.4</dependency.camel.version>
|
||||
<dependency.activemq.version>5.16.1</dependency.activemq.version>
|
||||
@@ -91,7 +91,6 @@
|
||||
<dependency.swagger-ui.version>3.38.0</dependency.swagger-ui.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.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>
|
||||
@@ -102,7 +101,6 @@
|
||||
<dependency.jakarta-jws-api.version>2.1.0</dependency.jakarta-jws-api.version>
|
||||
<dependency.jakarta-mail-api.version>1.6.5</dependency.jakarta-mail-api.version>
|
||||
<dependency.jakarta-json-api.version>1.1.6</dependency.jakarta-json-api.version>
|
||||
<dependency.jakarta-json-path.version>2.5.0</dependency.jakarta-json-path.version>
|
||||
<dependency.jakarta-rpc-api.version>1.1.4</dependency.jakarta-rpc-api.version>
|
||||
|
||||
<alfresco.googledrive.version>3.2.1.3</alfresco.googledrive.version>
|
||||
@@ -110,14 +108,14 @@
|
||||
<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.2.24</dependency.postgresql.version>
|
||||
<dependency.postgresql.version>42.2.20</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.mariadb.version>2.7.2</dependency.mariadb.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.64</dependency.tas-restapi.version>
|
||||
<dependency.tas-cmis.version>1.31</dependency.tas-cmis.version>
|
||||
<dependency.tas-cmis.version>1.30</dependency.tas-cmis.version>
|
||||
<dependency.tas-email.version>1.8</dependency.tas-email.version>
|
||||
<dependency.tas-webdav.version>1.6</dependency.tas-webdav.version>
|
||||
<dependency.tas-ftp.version>1.5</dependency.tas-ftp.version>
|
||||
@@ -144,7 +142,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>HEAD</tag>
|
||||
<tag>12.10</tag>
|
||||
</scm>
|
||||
|
||||
<distributionManagement>
|
||||
@@ -291,6 +289,11 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-mmt</artifactId>
|
||||
<version>${dependency.alfresco-mmt.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-server-root</artifactId>
|
||||
@@ -635,7 +638,7 @@
|
||||
<dependency>
|
||||
<groupId>org.jsoup</groupId>
|
||||
<artifactId>jsoup</artifactId>
|
||||
<version>1.14.3</version>
|
||||
<version>1.14.2</version>
|
||||
</dependency>
|
||||
<!-- upgrade dependency from TIKA -->
|
||||
<dependency>
|
||||
@@ -708,7 +711,7 @@
|
||||
<dependency>
|
||||
<groupId>joda-time</groupId>
|
||||
<artifactId>joda-time</artifactId>
|
||||
<version>2.10.12</version>
|
||||
<version>2.10.10</version>
|
||||
</dependency>
|
||||
|
||||
<!-- provided dependencies -->
|
||||
@@ -730,6 +733,11 @@
|
||||
<artifactId>gunit</artifactId>
|
||||
<version>${dependency.antlr.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-all</artifactId>
|
||||
<version>${dependency.mockito-all.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
@@ -842,7 +850,7 @@
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.22</version>
|
||||
<version>1.18.20</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
@@ -862,7 +870,7 @@
|
||||
<plugin>
|
||||
<groupId>io.fabric8</groupId>
|
||||
<artifactId>docker-maven-plugin</artifactId>
|
||||
<version>0.37.0</version>
|
||||
<version>0.34.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
@@ -878,12 +886,12 @@
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<version>3.3.2</version>
|
||||
<version>3.2.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.3.1</version>
|
||||
<version>3.3.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
<version>12.10</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
@@ -47,7 +47,7 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.santuario</groupId>
|
||||
<artifactId>xmlsec</artifactId>
|
||||
<version>2.2.3</version>
|
||||
<version>1.5.8</version>
|
||||
</dependency>
|
||||
<!-- newer version, see REPO-3133 -->
|
||||
<dependency>
|
||||
|
@@ -27,14 +27,17 @@ package org.alfresco.opencmis;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.EventListener;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -45,17 +48,19 @@ import javax.servlet.Servlet;
|
||||
import javax.servlet.ServletConfig;
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.ServletRegistration;
|
||||
import javax.servlet.SessionCookieConfig;
|
||||
import javax.servlet.SessionTrackingMode;
|
||||
import javax.servlet.descriptor.JspConfigDescriptor;
|
||||
import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.opencmis.CMISDispatcherRegistry.Binding;
|
||||
import org.alfresco.opencmis.CMISDispatcherRegistry.Endpoint;
|
||||
import org.alfresco.repo.tenant.TenantAdminService;
|
||||
import org.alfresco.rest.framework.core.exceptions.JsonpCallbackNotAllowedException;
|
||||
import org.alfresco.service.descriptor.Descriptor;
|
||||
import org.alfresco.service.descriptor.DescriptorService;
|
||||
import org.apache.chemistry.opencmis.commons.enums.CmisVersion;
|
||||
@@ -64,6 +69,7 @@ import org.apache.chemistry.opencmis.server.impl.CmisRepositoryContextListener;
|
||||
import org.apache.chemistry.opencmis.server.impl.atompub.CmisAtomPubServlet;
|
||||
import org.springframework.extensions.webscripts.WebScriptRequest;
|
||||
import org.springframework.extensions.webscripts.WebScriptResponse;
|
||||
import org.springframework.extensions.webscripts.servlet.WebScriptServletRuntime;
|
||||
|
||||
/**
|
||||
* Dispatches OpenCMIS requests to a servlet e.g. the OpenCMIS AtomPub servlet.
|
||||
@@ -84,8 +90,6 @@ public abstract class CMISServletDispatcher implements CMISDispatcher
|
||||
protected CmisVersion cmisVersion;
|
||||
protected TenantAdminService tenantAdminService;
|
||||
|
||||
private boolean allowUnsecureCallbackJSONP;
|
||||
|
||||
private Set<String> nonAttachContentTypes = Collections.emptySet(); // pre-configured whitelist, eg. images & pdf
|
||||
|
||||
public void setTenantAdminService(TenantAdminService tenantAdminService)
|
||||
@@ -147,17 +151,7 @@ public abstract class CMISServletDispatcher implements CMISDispatcher
|
||||
|
||||
return this.currentDescriptor;
|
||||
}
|
||||
|
||||
public void setAllowUnsecureCallbackJSONP(boolean allowUnsecureCallbackJSONP)
|
||||
{
|
||||
this.allowUnsecureCallbackJSONP = allowUnsecureCallbackJSONP;
|
||||
}
|
||||
|
||||
public boolean isAllowUnsecureCallbackJSONP()
|
||||
{
|
||||
return allowUnsecureCallbackJSONP;
|
||||
}
|
||||
|
||||
|
||||
public void init()
|
||||
{
|
||||
Endpoint endpoint = new Endpoint(getBinding(), version);
|
||||
@@ -225,22 +219,12 @@ public abstract class CMISServletDispatcher implements CMISDispatcher
|
||||
CMISHttpServletResponse httpResWrapper = getHttpResponse(res);
|
||||
CMISHttpServletRequest httpReqWrapper = getHttpRequest(req);
|
||||
|
||||
// check for "callback" query param
|
||||
if (!allowUnsecureCallbackJSONP && httpReqWrapper.getParameter("callback") != null)
|
||||
{
|
||||
throw new JsonpCallbackNotAllowedException();
|
||||
}
|
||||
servlet.service(httpReqWrapper, httpResWrapper);
|
||||
servlet.service(httpReqWrapper, httpResWrapper);
|
||||
}
|
||||
catch(ServletException e)
|
||||
{
|
||||
throw new AlfrescoRuntimeException("", e);
|
||||
}
|
||||
catch (JsonpCallbackNotAllowedException e)
|
||||
{
|
||||
res.setStatus(403);
|
||||
res.getWriter().append(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -23,10 +23,8 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
package org.alfresco.rest.api.probes;
|
||||
|
||||
import org.alfresco.repo.admin.RepoHealthChecker;
|
||||
import org.alfresco.rest.api.discovery.DiscoveryApiWebscript;
|
||||
import org.alfresco.rest.api.model.Probe;
|
||||
import org.alfresco.rest.framework.WebApiDescription;
|
||||
@@ -37,25 +35,28 @@ import org.alfresco.rest.framework.core.exceptions.ServiceUnavailableException;
|
||||
import org.alfresco.rest.framework.resource.EntityResource;
|
||||
import org.alfresco.rest.framework.resource.actions.interfaces.EntityResourceAction;
|
||||
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* An implementation of an Entity Resource for Probes.
|
||||
*/
|
||||
@EntityResource(name = "probes", title = "Probes") public class ProbeEntityResource
|
||||
implements EntityResourceAction.ReadById<Probe>
|
||||
@EntityResource(name="probes", title = "Probes")
|
||||
public class ProbeEntityResource implements EntityResourceAction.ReadById<Probe>
|
||||
{
|
||||
public static final String LIVE = "-live-";
|
||||
public static final String READY = "-ready-";
|
||||
|
||||
public static final long CHECK_PERIOD = 10 * 1000; // Maximum of only one checkResult every 10 seconds.
|
||||
|
||||
private final static Logger logger = LoggerFactory.getLogger(ProbeEntityResource.class);
|
||||
private final Object lock = new Object();
|
||||
private final Probe liveProbe = new Probe("liveProbe: Success - Tested");
|
||||
private long lastCheckTime = 0;
|
||||
private Boolean checkResult;
|
||||
private DiscoveryApiWebscript discovery;
|
||||
protected static Log logger = LogFactory.getLog(ProbeEntityResource.class);;
|
||||
|
||||
private RepoHealthChecker repoHealthChecker;
|
||||
private long nextCheckTime = 0;
|
||||
private Boolean checkResult;
|
||||
private Boolean checking = false;
|
||||
private boolean readySent;
|
||||
|
||||
private DiscoveryApiWebscript discovery;
|
||||
|
||||
public DiscoveryApiWebscript setDiscovery(DiscoveryApiWebscript discovery)
|
||||
{
|
||||
@@ -64,141 +65,145 @@ import org.slf4j.LoggerFactory;
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setRepoHealthChecker(RepoHealthChecker repoHealthChecker)
|
||||
{
|
||||
this.repoHealthChecker = repoHealthChecker;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a status code of 200 for okay. The probe contains little information for security reasons.
|
||||
*
|
||||
* Note: does *not* require authenticated access, so limits the amount of work performed to avoid a DDOS.
|
||||
*/
|
||||
@Override @WebApiDescription(title = "Get probe status", description = "Returns 200 if valid") @WebApiParam(name = "probeName", title = "The probe's name") @WebApiNoAuth public Probe readById(
|
||||
String name, Parameters parameters)
|
||||
@Override
|
||||
@WebApiDescription(title="Get probe status", description = "Returns 200 if valid")
|
||||
@WebApiParam(name = "probeName", title = "The probe's name")
|
||||
@WebApiNoAuth
|
||||
public Probe readById(String name, Parameters parameters)
|
||||
{
|
||||
ProbeType probeType = ProbeType.fromString(name);
|
||||
Probe probeResponse = null;
|
||||
|
||||
switch (probeType)
|
||||
boolean isLiveProbe = LIVE.equalsIgnoreCase(name);
|
||||
if (!isLiveProbe && !READY.equalsIgnoreCase(name))
|
||||
{
|
||||
case LIVE:
|
||||
probeResponse = liveProbe;
|
||||
break;
|
||||
case READY:
|
||||
String message = doReadyCheck();
|
||||
probeResponse = new Probe(message);
|
||||
break;
|
||||
case UNKNOWN:
|
||||
throw new InvalidArgumentException("Bad probe name");
|
||||
throw new InvalidArgumentException("Bad probe name");
|
||||
}
|
||||
|
||||
return probeResponse;
|
||||
String message = doCheckOrNothing(isLiveProbe);
|
||||
return new Probe(message);
|
||||
}
|
||||
|
||||
// We don't want to be doing checks all the time or holding monitors for a long time to avoid a DDOS.
|
||||
public String doReadyCheck()
|
||||
public String doCheckOrNothing(boolean isLiveProbe)
|
||||
{
|
||||
|
||||
synchronized (lock)
|
||||
boolean doCheck = false;
|
||||
long now = 0;
|
||||
boolean result;
|
||||
String message = "No test";
|
||||
boolean logInfo = false;
|
||||
synchronized(checking)
|
||||
{
|
||||
String message;
|
||||
long now = System.currentTimeMillis();
|
||||
|
||||
if (checkResult == null || isAfterCheckPeriod(now))
|
||||
// Initially ready needs to be false so we don't get requests and live true so the pod is not killed.
|
||||
if (checkResult == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
performReadinessCheck();
|
||||
checkResult = true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
checkResult = false;
|
||||
logger.debug("Exception during readiness check", e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
setLastCheckTime(now);
|
||||
message = getMessage(checkResult, "Tested");
|
||||
logger.info(message);
|
||||
|
||||
}
|
||||
result = isLiveProbe;
|
||||
}
|
||||
else
|
||||
{
|
||||
// if no check is performed, use previous check result
|
||||
message = getMessage(checkResult, "No test");
|
||||
logger.debug(message);
|
||||
|
||||
}
|
||||
if (checkResult)
|
||||
{
|
||||
return message;
|
||||
result = checkResult;
|
||||
}
|
||||
|
||||
throw new ServiceUnavailableException(message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private String getMessage(boolean result, String message)
|
||||
{
|
||||
|
||||
return "readyProbe: " + (result ? "Success" : "Failure") + " - " + message;
|
||||
|
||||
}
|
||||
|
||||
private void performReadinessCheck()
|
||||
{
|
||||
|
||||
discovery.getRepositoryInfo();
|
||||
repoHealthChecker.checkDatabase();
|
||||
logger.debug("All checks complete");
|
||||
|
||||
}
|
||||
|
||||
private void setLastCheckTime(long time)
|
||||
{
|
||||
this.lastCheckTime = time;
|
||||
long nextCheckTime = lastCheckTime + CHECK_PERIOD;
|
||||
|
||||
logger.trace("nextCheckTime: {} (+{} secs)", nextCheckTime, ((CHECK_PERIOD) / 1000));
|
||||
|
||||
}
|
||||
|
||||
private boolean isAfterCheckPeriod(long currentTime)
|
||||
{
|
||||
return ((currentTime - lastCheckTime) >= CHECK_PERIOD);
|
||||
}
|
||||
|
||||
public enum ProbeType
|
||||
{
|
||||
LIVE("-live-"), READY("-ready-"), UNKNOWN("");
|
||||
|
||||
String value;
|
||||
|
||||
ProbeType(String strValue)
|
||||
{
|
||||
value = strValue;
|
||||
}
|
||||
|
||||
public static ProbeType fromString(String text)
|
||||
{
|
||||
for (ProbeType p : ProbeType.values())
|
||||
if (checking) // Is another thread is checking?
|
||||
{
|
||||
if (p.value.equalsIgnoreCase(text))
|
||||
if (!readySent && result && !isLiveProbe)
|
||||
{
|
||||
return p;
|
||||
readySent = true;
|
||||
logInfo = true;
|
||||
}
|
||||
}
|
||||
else // This thread will do a check
|
||||
{
|
||||
now = System.currentTimeMillis();
|
||||
if (checkResult == null || nextCheckTime <= now)
|
||||
{
|
||||
doCheck = true;
|
||||
checking = true;
|
||||
}
|
||||
}
|
||||
return UNKNOWN;
|
||||
}
|
||||
|
||||
public String getValue()
|
||||
if (doCheck)
|
||||
{
|
||||
return value;
|
||||
try
|
||||
{
|
||||
message = "Tested";
|
||||
doCheck(isLiveProbe);
|
||||
result = true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
finally
|
||||
{
|
||||
synchronized (checking)
|
||||
{
|
||||
checking = false;
|
||||
checkResult = result;
|
||||
setNextCheckTime(now);
|
||||
if (result && !readySent && !isLiveProbe) // Are we initially ready
|
||||
{
|
||||
readySent = true;
|
||||
logInfo = true;
|
||||
}
|
||||
else if (!result && (isLiveProbe || readySent)) // Are we sick
|
||||
{
|
||||
logInfo = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
message = getMessage(isLiveProbe, result, message);
|
||||
|
||||
if (logInfo)
|
||||
{
|
||||
logger.info(message);
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.debug(message);
|
||||
}
|
||||
|
||||
if (result)
|
||||
{
|
||||
return message;
|
||||
}
|
||||
throw new ServiceUnavailableException(message);
|
||||
}
|
||||
|
||||
private String getMessage(boolean isLiveProbe, boolean result, String message)
|
||||
{
|
||||
return (isLiveProbe ? "liveProbe" : "readyProbe")+": "+
|
||||
(result ? "Success" : "Failure") +
|
||||
" - "+message;
|
||||
}
|
||||
|
||||
private void doCheck(boolean isLiveProbe)
|
||||
{
|
||||
discovery.getRepositoryInfo();
|
||||
}
|
||||
|
||||
private void setNextCheckTime(long now)
|
||||
{
|
||||
long oldValue = nextCheckTime;
|
||||
if (nextCheckTime == 0)
|
||||
{
|
||||
nextCheckTime = (now / 60000) * 60000;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
nextCheckTime += CHECK_PERIOD;
|
||||
}
|
||||
while (nextCheckTime <= now);
|
||||
|
||||
if (logger.isTraceEnabled())
|
||||
{
|
||||
logger.trace("nextCheckTime: " + nextCheckTime + " (+" + ((nextCheckTime - oldValue) / 1000) + " secs)");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -78,7 +78,6 @@ import org.alfresco.rest.api.search.model.SearchSQLQuery;
|
||||
import org.alfresco.rest.api.search.model.TupleEntry;
|
||||
import org.alfresco.rest.api.search.model.TupleList;
|
||||
import org.alfresco.rest.framework.core.exceptions.EntityNotFoundException;
|
||||
import org.alfresco.rest.framework.core.exceptions.PermissionDeniedException;
|
||||
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
||||
import org.alfresco.rest.framework.resource.parameters.Paging;
|
||||
import org.alfresco.rest.framework.resource.parameters.Params;
|
||||
@@ -153,7 +152,7 @@ public class ResultMapper
|
||||
* Turns the results into a CollectionWithPagingInfo
|
||||
* @param params
|
||||
* @param searchQuery
|
||||
* @param results @return CollectionWithPagingInfo<Node>
|
||||
*@param results @return CollectionWithPagingInfo<Node>
|
||||
*/
|
||||
public CollectionWithPagingInfo<Node> toCollectionWithPagingInfo(Params params, SearchRequestContext searchRequestContext, SearchQuery searchQuery, ResultSet results)
|
||||
{
|
||||
@@ -206,69 +205,61 @@ public class ResultMapper
|
||||
* @param params
|
||||
* @param mapUserInfo
|
||||
* @param isHistory
|
||||
* @return The node object or null if the user does not have permission to view it.
|
||||
* @return Node
|
||||
*/
|
||||
public Node getNode(ResultSetRow aRow, Params params, Map<String, UserInfo> mapUserInfo, boolean isHistory)
|
||||
{
|
||||
String nodeStore = isHistory ? HISTORY : storeMapper.getStore(aRow.getNodeRef());
|
||||
|
||||
String nodeStore = storeMapper.getStore(aRow.getNodeRef());
|
||||
if (isHistory) nodeStore = HISTORY;
|
||||
Node aNode = null;
|
||||
try
|
||||
|
||||
switch (nodeStore)
|
||||
{
|
||||
switch (nodeStore)
|
||||
{
|
||||
case LIVE_NODES:
|
||||
aNode = nodes.getFolderOrDocument(aRow.getNodeRef(), null, null, params.getInclude(), mapUserInfo);
|
||||
break;
|
||||
case HISTORY:
|
||||
aNode = nodes.getFolderOrDocument(aRow.getNodeRef(), null, null, params.getInclude(), mapUserInfo);
|
||||
break;
|
||||
case VERSIONS:
|
||||
Map<QName, Serializable> properties = serviceRegistry.getNodeService().getProperties(aRow.getNodeRef());
|
||||
NodeRef frozenNodeRef = ((NodeRef) properties.get(Version2Model.PROP_QNAME_FROZEN_NODE_REF));
|
||||
String versionLabelId = (String) properties.get(Version2Model.PROP_QNAME_VERSION_LABEL);
|
||||
Version v = null;
|
||||
try
|
||||
case LIVE_NODES:
|
||||
aNode = nodes.getFolderOrDocument(aRow.getNodeRef(), null, null, params.getInclude(), mapUserInfo);
|
||||
break;
|
||||
case HISTORY:
|
||||
aNode = nodes.getFolderOrDocument(aRow.getNodeRef(), null, null, params.getInclude(), mapUserInfo);
|
||||
break;
|
||||
case VERSIONS:
|
||||
Map<QName, Serializable> properties = serviceRegistry.getNodeService().getProperties(aRow.getNodeRef());
|
||||
NodeRef frozenNodeRef = ((NodeRef) properties.get(Version2Model.PROP_QNAME_FROZEN_NODE_REF));
|
||||
String versionLabelId = (String) properties.get(Version2Model.PROP_QNAME_VERSION_LABEL);
|
||||
Version v = null;
|
||||
try
|
||||
{
|
||||
if (frozenNodeRef != null && versionLabelId != null)
|
||||
{
|
||||
if (frozenNodeRef != null && versionLabelId != null)
|
||||
{
|
||||
v = nodeVersions.findVersion(frozenNodeRef.getId(), versionLabelId);
|
||||
aNode = nodes.getFolderOrDocument(v.getFrozenStateNodeRef(), null, null, params.getInclude(), mapUserInfo);
|
||||
}
|
||||
v = nodeVersions.findVersion(frozenNodeRef.getId(),versionLabelId);
|
||||
aNode = nodes.getFolderOrDocument(v.getFrozenStateNodeRef(), null, null, params.getInclude(), mapUserInfo);
|
||||
}
|
||||
catch (EntityNotFoundException | InvalidNodeRefException e)
|
||||
{
|
||||
//Solr says there is a node but we can't find it
|
||||
logger.debug("Failed to find a versioned node with id of " + frozenNodeRef
|
||||
}
|
||||
catch (EntityNotFoundException|InvalidNodeRefException e)
|
||||
{
|
||||
//Solr says there is a node but we can't find it
|
||||
logger.debug("Failed to find a versioned node with id of "+frozenNodeRef
|
||||
+ " this is probably because the original node has been deleted.");
|
||||
}
|
||||
}
|
||||
|
||||
if (v != null && aNode != null)
|
||||
{
|
||||
nodeVersions.mapVersionInfo(v, aNode, aRow.getNodeRef());
|
||||
aNode.setNodeId(frozenNodeRef.getId());
|
||||
aNode.setVersionLabel(versionLabelId);
|
||||
}
|
||||
break;
|
||||
case DELETED:
|
||||
try
|
||||
{
|
||||
aNode = deletedNodes.getDeletedNode(aRow.getNodeRef().getId(), params, false, mapUserInfo);
|
||||
}
|
||||
catch (EntityNotFoundException enfe)
|
||||
{
|
||||
//Solr says there is a deleted node but we can't find it, we want the rest of the search to return so lets ignore it.
|
||||
logger.debug("Failed to find a deleted node with id of " + aRow.getNodeRef().getId());
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (v != null && aNode != null)
|
||||
{
|
||||
nodeVersions.mapVersionInfo(v, aNode, aRow.getNodeRef());
|
||||
aNode.setNodeId(frozenNodeRef.getId());
|
||||
aNode.setVersionLabel(versionLabelId);
|
||||
}
|
||||
break;
|
||||
case DELETED:
|
||||
try
|
||||
{
|
||||
aNode = deletedNodes.getDeletedNode(aRow.getNodeRef().getId(), params, false, mapUserInfo);
|
||||
}
|
||||
catch (EntityNotFoundException enfe)
|
||||
{
|
||||
//Solr says there is a deleted node but we can't find it, we want the rest of the search to return so lets ignore it.
|
||||
logger.debug("Failed to find a deleted node with id of "+aRow.getNodeRef().getId());
|
||||
}
|
||||
break;
|
||||
}
|
||||
catch (PermissionDeniedException e)
|
||||
{
|
||||
logger.debug("Unable to access node: " + aRow.toString());
|
||||
return null;
|
||||
}
|
||||
|
||||
if (aNode != null)
|
||||
{
|
||||
aNode.setLocation(nodeStore);
|
||||
|
@@ -1,49 +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;
|
||||
|
||||
/**
|
||||
* JSONP callback not allowed
|
||||
*
|
||||
* @author Vitor Moreira
|
||||
*/
|
||||
public class JsonpCallbackNotAllowedException extends ApiException
|
||||
{
|
||||
private static final long serialVersionUID = 7198491358180044895L;
|
||||
|
||||
public static String DEFAULT_MESSAGE_ID = "framework.exception.JsonpCallbackNotAllowed";
|
||||
|
||||
public JsonpCallbackNotAllowedException()
|
||||
{
|
||||
super(DEFAULT_MESSAGE_ID);
|
||||
}
|
||||
|
||||
public JsonpCallbackNotAllowedException(String msgId)
|
||||
{
|
||||
super(msgId);
|
||||
}
|
||||
|
||||
}
|
@@ -14,6 +14,4 @@ framework.exception.UnsupportedResourceOperation=The operation is unsupported
|
||||
framework.exception.DeletedResource=In this version of the REST API resource {0} has been deleted
|
||||
framework.exception.RequestEntityTooLarge=The file can't be uploaded because it's larger than the maximum upload size
|
||||
framework.exception.InsufficientStorage=The file upload exceeds the content storage allowance
|
||||
framework.exception.JsonpCallbackNotAllowed=For security reasons the callback parameter is not allowed
|
||||
framework.no.stacktrace=For security reasons the stack trace is no longer displayed, but the property is kept for previous versions
|
||||
|
||||
|
@@ -1075,7 +1075,6 @@
|
||||
|
||||
<bean id="org.alfresco.rest.api.probes.ProbeEntityResource.get" class="org.alfresco.rest.api.probes.ProbeEntityResource">
|
||||
<property name="discovery" ref="webscript.org.alfresco.api.DiscoveryApiWebscript.get" />
|
||||
<property name="repoHealthChecker" ref="repoHealthChecker" />
|
||||
</bean>
|
||||
|
||||
<!-- REST API direct access URL configuration settings -->
|
||||
@@ -1139,7 +1138,6 @@
|
||||
<property name="cmisVersion" value="1.1"/>
|
||||
<property name="tenantAdminService" ref="tenantAdminService"/>
|
||||
<property name="nonAttachContentTypes" ref="nodes.nonAttachContentTypes"/>
|
||||
<property name="allowUnsecureCallbackJSONP" value="${allow.unsecure.callback.jsonp}"/>
|
||||
</bean>
|
||||
|
||||
<bean id="webscript.org.alfresco.api.opencmis.OpenCMIS.get"
|
||||
|
@@ -33,7 +33,7 @@
|
||||
<#elseif v?is_number>
|
||||
${v?c}
|
||||
<#elseif v?is_string>
|
||||
"${v?html}"
|
||||
"${v?string}"
|
||||
<#elseif v?is_hash>
|
||||
<#if v?keys?size gt maxDepth >
|
||||
<#stop "Max depth of object achieved">
|
||||
@@ -188,7 +188,7 @@ ${url.serviceContext}/api/node/${nodeRef?replace("://","/")}/content;${prop?url}
|
||||
</tr>
|
||||
<#list result.children as n>
|
||||
<tr>
|
||||
<td><a href="#" onclick="AdminConsole_childClick('${n.childRef}');return false;">${n.QName?html}</a></td>
|
||||
<td><a href="#" onclick="AdminConsole_childClick('${n.childRef}');return false;">${n.QName}</a></td>
|
||||
<td><a href="#" onclick="AdminConsole_childClick('${n.childRef}');return false;">${n.childRef}</a></td>
|
||||
<td>${n.primary?string}</td>
|
||||
<td>${n.typeQName}</td>
|
||||
@@ -222,7 +222,7 @@ ${url.serviceContext}/api/node/${nodeRef?replace("://","/")}/content;${prop?url}
|
||||
</tr>
|
||||
<#list result.parents as p>
|
||||
<tr>
|
||||
<td>${p.name.prefixedName?html}</td>
|
||||
<td>${p.name.prefixedName}</td>
|
||||
<td>${p.parentTypeName.prefixedName}</td>
|
||||
<td><a href="#" onclick="AdminConsole_parentClick('${p.parentRef}');return false;">${p.parentRef}</a></td></td>
|
||||
<td>${p.primary?string}</td>
|
||||
@@ -280,7 +280,7 @@ ${url.serviceContext}/api/node/${nodeRef?replace("://","/")}/content;${prop?url}
|
||||
<@section label=msg("nodebrowser.permissions") />
|
||||
<table id="perminfo-table" class="node">
|
||||
<tr><td>${msg("nodebrowser.inherits")}: ${result.permissions.inherit?string}</td></tr>
|
||||
<tr><td>${msg("nodebrowser.owner")}: <#if result.permissions.owner??>${result.permissions.owner?html}</#if></td></tr>
|
||||
<tr><td>${msg("nodebrowser.owner")}: ${result.permissions.owner!""}</td></tr>
|
||||
</table>
|
||||
<table id="permissions-table" class="node grid">
|
||||
<tr>
|
||||
@@ -291,7 +291,7 @@ ${url.serviceContext}/api/node/${nodeRef?replace("://","/")}/content;${prop?url}
|
||||
<#list result.permissions.entries as p>
|
||||
<tr>
|
||||
<td>${p.permission}</td>
|
||||
<td>${p.authority?html}</td>
|
||||
<td>${p.authority}</td>
|
||||
<td>${p.accessStatus}</td>
|
||||
</tr>
|
||||
</#list>
|
||||
|
@@ -25,27 +25,24 @@
|
||||
*/
|
||||
package org.alfresco.rest.api.search;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
|
||||
import static junit.framework.TestCase.assertEquals;
|
||||
import static junit.framework.TestCase.assertFalse;
|
||||
import static junit.framework.TestCase.assertNotNull;
|
||||
import static junit.framework.TestCase.assertNull;
|
||||
import static junit.framework.TestCase.assertTrue;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.ArgumentMatchers.nullable;
|
||||
import static org.mockito.Mockito.any;
|
||||
import static org.mockito.Mockito.anyBoolean;
|
||||
import static org.mockito.Mockito.anyString;
|
||||
import static org.mockito.Mockito.notNull;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.reset;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -88,7 +85,6 @@ import org.alfresco.rest.api.search.model.SearchQuery;
|
||||
import org.alfresco.rest.api.search.model.SearchSQLQuery;
|
||||
import org.alfresco.rest.api.search.model.TupleList;
|
||||
import org.alfresco.rest.framework.core.exceptions.EntityNotFoundException;
|
||||
import org.alfresco.rest.framework.core.exceptions.PermissionDeniedException;
|
||||
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
||||
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
||||
import org.alfresco.rest.framework.resource.parameters.Params;
|
||||
@@ -100,7 +96,6 @@ import org.alfresco.service.cmr.search.FieldHighlightParameters;
|
||||
import org.alfresco.service.cmr.search.GeneralHighlightParameters;
|
||||
import org.alfresco.service.cmr.search.LimitBy;
|
||||
import org.alfresco.service.cmr.search.ResultSet;
|
||||
import org.alfresco.service.cmr.search.ResultSetRow;
|
||||
import org.alfresco.service.cmr.search.SearchParameters;
|
||||
import org.alfresco.service.cmr.version.Version;
|
||||
import org.alfresco.service.cmr.version.VersionHistory;
|
||||
@@ -108,11 +103,14 @@ import org.alfresco.service.cmr.version.VersionService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.util.GUID;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.json.JSONTokener;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.mockito.invocation.InvocationOnMock;
|
||||
import org.mockito.stubbing.Answer;
|
||||
import org.springframework.extensions.webscripts.WebScriptRequest;
|
||||
|
||||
/**
|
||||
* Tests the ResultMapper class
|
||||
@@ -140,22 +138,21 @@ public class ResultMapperTests
|
||||
+ "},"
|
||||
+ "\"stats\":{\"stats_fields\":{\"numericLabel\":{\"sumOfSquares\":0,\"min\":null,\"max\":null,\"mean\":\"NaN\",\"percentiles\":[\"0.0\",12,\"0.99\",20.0685], \"count\":0,\"missing\":0,\"sum\":0,\"distinctValues\":[12,13,14,15,16,17,1],\"stddev\":0}, \"creator\":{\"min\":\"System\",\"max\":\"mjackson\",\"count\":\"990\",\"missing\":\"290\"}, \"created\":{\"sumOfSquares\":2.1513045770343806E27,\"min\":\"2011-02-15T20:16:27.080Z\",\"max\":\"2017-04-10T15:06:30.143Z\",\"mean\":\"2016-09-05T04:20:12.898Z\",\"count\":990,\"missing\":290,\"sum\":1.458318720769983E15,\"stddev\":5.6250677994522545E10}}},"
|
||||
+ "\"processedDenies\":true, \"lastIndexedTx\":34}";
|
||||
public static final Params EMPTY_PARAMS = Params.valueOf((String) null, null, null);
|
||||
public static final Params EMPTY_PARAMS = Params.valueOf((String)null,(String)null,(WebScriptRequest) null);
|
||||
public static final String FROZEN_ID = "frozen";
|
||||
public static final String FROZEN_VER = "1.1";
|
||||
private static final long VERSIONED_ID = 521l;
|
||||
|
||||
private static SerializerTestHelper helper;
|
||||
private static NodesImpl nodes;
|
||||
|
||||
@BeforeClass
|
||||
public static void setupTests()
|
||||
public static void setupTests() throws Exception
|
||||
{
|
||||
Map<String, UserInfo> mapUserInfo = new HashMap<>();
|
||||
mapUserInfo.put(AuthenticationUtil.getSystemUserName(), new UserInfo(AuthenticationUtil.getSystemUserName(), "sys", "sys"));
|
||||
Map<QName, Serializable> nodeProps = new HashMap<>();
|
||||
|
||||
nodes = mock(NodesImpl.class);
|
||||
NodesImpl nodes = mock(NodesImpl.class);
|
||||
ServiceRegistry sr = mock(ServiceRegistry.class);
|
||||
DeletedNodes deletedNodes = mock(DeletedNodes.class);
|
||||
nodes.setServiceRegistry(sr);
|
||||
@@ -166,10 +163,17 @@ public class ResultMapperTests
|
||||
versionProperties.put(Version.PROP_DESCRIPTION, "ver desc");
|
||||
versionProperties.put(Version2Model.PROP_VERSION_TYPE, "v type");
|
||||
when(versionHistory.getVersion(anyString())).thenAnswer(invocation ->
|
||||
new VersionImpl(versionProperties, new NodeRef(StoreMapper.STORE_REF_VERSION2_SPACESSTORE, GUID.generate())));
|
||||
{
|
||||
return new VersionImpl(versionProperties,new NodeRef(StoreMapper.STORE_REF_VERSION2_SPACESSTORE, GUID.generate()));
|
||||
});
|
||||
NodeService nodeService = mock(NodeService.class);
|
||||
|
||||
when(versionService.getVersionHistory(any(NodeRef.class))).thenReturn(versionHistory);
|
||||
when(versionService.getVersionHistory(any(NodeRef.class))).thenAnswer(invocation ->
|
||||
{
|
||||
Object[] args = invocation.getArguments();
|
||||
NodeRef aNode = (NodeRef)args[0];
|
||||
return versionHistory;
|
||||
});
|
||||
|
||||
when(nodeService.getProperties(any(NodeRef.class))).thenAnswer(invocation ->
|
||||
{
|
||||
@@ -200,26 +204,31 @@ public class ResultMapperTests
|
||||
}
|
||||
});
|
||||
|
||||
when(nodes.getFolderOrDocument(any(NodeRef.class), nullable(NodeRef.class), nullable(QName.class), nullable(List.class), nullable(Map.class))).thenAnswer((Answer<Node>) invocation ->
|
||||
{
|
||||
Object[] args = invocation.getArguments();
|
||||
NodeRef aNode = (NodeRef)args[0];
|
||||
if (StoreRef.STORE_REF_ARCHIVE_SPACESSTORE.equals(aNode.getStoreRef()))
|
||||
{
|
||||
//Return NULL if its from the archive store.
|
||||
return null;
|
||||
// // NodeRef nodeRef = nodes.validateOrLookupNode(nodeId, null);
|
||||
when(nodes.getFolderOrDocument(any(NodeRef.class), nullable(NodeRef.class), nullable(QName.class), nullable(List.class), nullable(Map.class))).thenAnswer(new Answer<Node>() {
|
||||
@Override
|
||||
public Node answer(InvocationOnMock invocation) throws Throwable {
|
||||
Object[] args = invocation.getArguments();
|
||||
NodeRef aNode = (NodeRef)args[0];
|
||||
if (StoreRef.STORE_REF_ARCHIVE_SPACESSTORE.equals(aNode.getStoreRef()))
|
||||
{
|
||||
//Return NULL if its from the archive store.
|
||||
return null;
|
||||
}
|
||||
return new Node(aNode, (NodeRef)args[1], nodeProps, mapUserInfo, sr);
|
||||
}
|
||||
return new Node(aNode, (NodeRef)args[1], nodeProps, mapUserInfo, sr);
|
||||
});
|
||||
|
||||
when(deletedNodes.getDeletedNode(nullable(String.class), nullable(
|
||||
Parameters.class), anyBoolean(), nullable(Map.class))).thenAnswer((Answer<Node>) invocation ->
|
||||
{
|
||||
Object[] args = invocation.getArguments();
|
||||
String nodeId = (String)args[0];
|
||||
if (FROZEN_ID.equals(nodeId)) throw new EntityNotFoundException(nodeId);
|
||||
NodeRef aNode = new NodeRef(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE, nodeId);
|
||||
return new Node(aNode, new NodeRef(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE,"unknown"), nodeProps, mapUserInfo, sr);
|
||||
Parameters.class), anyBoolean(), nullable(Map.class))).thenAnswer(new Answer<Node>() {
|
||||
@Override
|
||||
public Node answer(InvocationOnMock invocation) throws Throwable {
|
||||
Object[] args = invocation.getArguments();
|
||||
String nodeId = (String)args[0];
|
||||
if (FROZEN_ID.equals(nodeId)) throw new EntityNotFoundException(nodeId);
|
||||
NodeRef aNode = new NodeRef(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE, nodeId);
|
||||
return new Node(aNode, new NodeRef(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE,"unknown"), nodeProps, mapUserInfo, sr);
|
||||
}
|
||||
});
|
||||
|
||||
PersonPropertyLookup propertyLookups = mock(PersonPropertyLookup.class);
|
||||
@@ -227,10 +236,11 @@ public class ResultMapperTests
|
||||
when(propertyLookups.lookup(notNull(String.class))).thenAnswer(invocation -> {
|
||||
Object[] args = invocation.getArguments();
|
||||
String value = (String)args[0];
|
||||
return "mjackson".equals(value) ? "Michael Jackson" : null;
|
||||
if ("mjackson".equals(value)) return "Michael Jackson";
|
||||
return null;
|
||||
});
|
||||
PropertyLookupRegistry propertyLookupRegistry = new PropertyLookupRegistry();
|
||||
propertyLookupRegistry.setLookups(asList(propertyLookups));
|
||||
propertyLookupRegistry.setLookups(Arrays.asList(propertyLookups));
|
||||
mapper = new ResultMapper();
|
||||
mapper.setNodes(nodes);
|
||||
mapper.setStoreMapper(new StoreMapper());
|
||||
@@ -248,7 +258,7 @@ public class ResultMapperTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoResults()
|
||||
public void testNoResults() throws Exception
|
||||
{
|
||||
SearchRequestContext searchRequest = SearchRequestContext.from(SearchQuery.EMPTY);
|
||||
CollectionWithPagingInfo<Node> collection = mapper.toCollectionWithPagingInfo(EMPTY_PARAMS, searchRequest, null, new EmptyResultSet());
|
||||
@@ -259,9 +269,9 @@ public class ResultMapperTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testToCollectionWithPagingInfo()
|
||||
public void testToCollectionWithPagingInfo() throws Exception
|
||||
{
|
||||
ResultSet results = mockResultSet(asList(514l), asList(566l, VERSIONED_ID));
|
||||
ResultSet results = mockResultset(Arrays.asList(514l), Arrays.asList(566l, VERSIONED_ID));
|
||||
SearchRequestContext searchRequest = SearchRequestContext.from(SearchQuery.EMPTY);
|
||||
CollectionWithPagingInfo<Node> collectionWithPage = mapper.toCollectionWithPagingInfo(EMPTY_PARAMS, searchRequest, SearchQuery.EMPTY, results);
|
||||
assertNotNull(collectionWithPage);
|
||||
@@ -288,12 +298,12 @@ public class ResultMapperTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testToSearchContext()
|
||||
public void testToSearchContext() throws Exception
|
||||
{
|
||||
ResultSet results = mockResultSet(Collections.emptyList(),Collections.emptyList());
|
||||
ResultSet results = mockResultset(Collections.emptyList(),Collections.emptyList());
|
||||
SearchQuery searchQuery = helper.searchQueryFromJson();
|
||||
SearchRequestContext searchRequest = SearchRequestContext.from(searchQuery);
|
||||
searchMapper.toSearchParameters(EMPTY_PARAMS, searchQuery, searchRequest);
|
||||
SearchParameters searchParams = searchMapper.toSearchParameters(EMPTY_PARAMS, searchQuery, searchRequest);
|
||||
SearchContext searchContext = mapper.toSearchContext((SearchEngineResultSet) results, searchRequest, searchQuery);
|
||||
assertEquals(34l, searchContext.getConsistency().getlastTxId());
|
||||
assertEquals(6, searchContext.getFacetQueries().size());
|
||||
@@ -374,9 +384,9 @@ public class ResultMapperTests
|
||||
assertTrue(statsMetrics.contains(new SimpleMetric(METRIC_TYPE.missing, 0)));
|
||||
assertTrue(statsMetrics.contains(new SimpleMetric(METRIC_TYPE.sum, 0)));
|
||||
assertTrue(statsMetrics.contains(new SimpleMetric(METRIC_TYPE.stddev, 0)));
|
||||
JSONArray dVals = new JSONArray(asList(12, 13, 14, 15, 16, 17, 1));
|
||||
JSONArray dVals = new JSONArray(Arrays.asList(12, 13, 14, 15, 16, 17, 1));
|
||||
assertTrue(statsMetrics.contains(new ListMetric(METRIC_TYPE.distinctValues, dVals)));
|
||||
JSONArray pers = new JSONArray(asList("0.99",20.0685, "0.0", 12.0));
|
||||
JSONArray pers = new JSONArray(Arrays.asList("0.99",20.0685, "0.0", 12.0));
|
||||
assertTrue(statsMetrics.contains(new PercentileMetric(METRIC_TYPE.percentiles, pers)));
|
||||
|
||||
assertEquals("min must be excluded because its null",0,statsMetrics.stream().filter(metric -> METRIC_TYPE.min.equals(metric.getType())).count());
|
||||
@@ -385,18 +395,18 @@ public class ResultMapperTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsNullContext()
|
||||
public void testIsNullContext() throws Exception
|
||||
{
|
||||
assertTrue(mapper.isNullContext(new SearchContext(0l,null,null,null,null, null)));
|
||||
assertFalse(mapper.isNullContext(new SearchContext(1l,null,null,null,null, null)));
|
||||
assertFalse(mapper.isNullContext(new SearchContext(0l,null,null,null,new SpellCheckContext(null, null), null)));
|
||||
assertFalse(mapper.isNullContext(new SearchContext(0l,null, asList(new FacetQueryContext(null, null, 0)),null,null, null)));
|
||||
assertFalse(mapper.isNullContext(new SearchContext(0l,null,null, asList(new FacetFieldContext(null, null)),null, null)));
|
||||
assertFalse(mapper.isNullContext(new SearchContext(0l, asList(new GenericFacetResponse(null,null, null)),null,null, null, null)));
|
||||
assertFalse(mapper.isNullContext(new SearchContext(0l,null, Arrays.asList(new FacetQueryContext(null, null, 0)),null,null, null)));
|
||||
assertFalse(mapper.isNullContext(new SearchContext(0l,null,null,Arrays.asList(new FacetFieldContext(null, null)),null, null)));
|
||||
assertFalse(mapper.isNullContext(new SearchContext(0l,Arrays.asList(new GenericFacetResponse(null,null, null)),null,null, null, null)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHighlight()
|
||||
public void testHighlight() throws Exception
|
||||
{
|
||||
SearchParameters sp = new SearchParameters();
|
||||
sp.setBulkFetchEnabled(false);
|
||||
@@ -422,11 +432,12 @@ public class ResultMapperTests
|
||||
|
||||
|
||||
@Test
|
||||
public void testInterval()
|
||||
public void testInterval() throws Exception
|
||||
{
|
||||
ResultSet results = mockResultSet(Collections.emptyList(),Collections.emptyList());
|
||||
ResultSet results = mockResultset(Collections.emptyList(),Collections.emptyList());
|
||||
SearchQuery searchQuery = helper.searchQueryFromJson();
|
||||
SearchRequestContext searchRequest = SearchRequestContext.from(searchQuery);
|
||||
SearchParameters searchParams = searchMapper.toSearchParameters(EMPTY_PARAMS, searchQuery, searchRequest);
|
||||
SearchContext searchContext = mapper.toSearchContext((SearchEngineResultSet) results, searchRequest, searchQuery);
|
||||
|
||||
//Facet intervals
|
||||
@@ -460,13 +471,13 @@ public class ResultMapperTests
|
||||
assertEquals(METRIC_TYPE.count,((SimpleMetric) metrics[0]).getType());
|
||||
assertEquals("854",((SimpleMetric) metrics[0]).getValue().get("count"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRange()
|
||||
public void testRange() throws Exception
|
||||
{
|
||||
ResultSet results = mockResultSet(Collections.emptyList(),Collections.emptyList());
|
||||
ResultSet results = mockResultset(Collections.emptyList(),Collections.emptyList());
|
||||
SearchQuery searchQuery = helper.searchQueryFromJson();
|
||||
SearchRequestContext searchRequest = SearchRequestContext.from(searchQuery);
|
||||
SearchParameters searchParams = searchMapper.toSearchParameters(EMPTY_PARAMS, searchQuery, searchRequest);
|
||||
SearchContext searchContext = mapper.toSearchContext((SearchEngineResultSet) results, searchRequest, searchQuery);
|
||||
|
||||
//Numeric facet range
|
||||
@@ -513,14 +524,14 @@ public class ResultMapperTests
|
||||
assertEquals("300",facetInfo.get("end"));
|
||||
assertEquals("content.size:[\"200\" TO \"300\">", rangeFacets.get(1).getBuckets().get(2).getFilterQuery());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRangeExclusiec()
|
||||
public void testRangeExclusiec() throws Exception
|
||||
{
|
||||
ResultSet results = mockResultSet(Collections.emptyList(),Collections.emptyList());
|
||||
ResultSet results = mockResultset(Collections.emptyList(),Collections.emptyList());
|
||||
String updatedJSON = helper.JSON.replace("lower", "upper");
|
||||
SearchQuery searchQuery = helper.extractFromJson(updatedJSON);
|
||||
SearchRequestContext searchRequest = SearchRequestContext.from(searchQuery);
|
||||
SearchParameters searchParams = searchMapper.toSearchParameters(EMPTY_PARAMS, searchQuery, searchRequest);
|
||||
SearchContext searchContext = mapper.toSearchContext((SearchEngineResultSet) results, searchRequest, searchQuery);
|
||||
|
||||
//Numeric facet range
|
||||
@@ -543,25 +554,26 @@ public class ResultMapperTests
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
/**
|
||||
* Test facet group with out facet fields
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
public void testFacetingGroupResponse()
|
||||
public void testFacetingGroupResponse() throws Exception
|
||||
{
|
||||
String jsonQuery = "{\"query\": {\"query\": \"alfresco\"},"
|
||||
+ "\"facetQueries\": ["
|
||||
+ "{\"query\": \"content.size:[o TO 102400]\", \"label\": \"small\",\"group\":\"foo\"},"
|
||||
+ "{\"query\": \"content.size:[102400 TO 1048576]\", \"label\": \"medium\",\"group\":\"foo\"},"
|
||||
+ "{\"query\": \"content.size:[1048576 TO 16777216]\", \"label\": \"large\",\"group\":\"foo\"}]"
|
||||
+ "}";
|
||||
|
||||
+ "\"facetQueries\": ["
|
||||
+ "{\"query\": \"content.size:[o TO 102400]\", \"label\": \"small\",\"group\":\"foo\"},"
|
||||
+ "{\"query\": \"content.size:[102400 TO 1048576]\", \"label\": \"medium\",\"group\":\"foo\"},"
|
||||
+ "{\"query\": \"content.size:[1048576 TO 16777216]\", \"label\": \"large\",\"group\":\"foo\"}]"
|
||||
+ "}";
|
||||
|
||||
String expectedResponse = "{\"responseHeader\":{\"status\":0,\"QTime\":9},\"_original_parameters_\":\"org.apache.solr.common.params.DefaultSolrParams:{params(df=TEXT&alternativeDic=DEFAULT_DICTIONARY&fl=DBID,score&start=0&fq={!afts}AUTHORITY_FILTER_FROM_JSON&fq={!afts}TENANT_FILTER_FROM_JSON&rows=1000&locale=en_US&wt=json),defaults(carrot.url=id&spellcheck.collateExtendedResults=true&carrot.produceSummary=true&spellcheck.maxCollations=3&spellcheck.maxCollationTries=5&spellcheck.alternativeTermCount=2&spellcheck.extendedResults=false&defType=afts&spellcheck.maxResultsForSuggest=5&spellcheck=false&carrot.outputSubClusters=false&spellcheck.count=5&carrot.title=mltext@m___t@{http://www.alfresco.org/model/content/1.0}title&carrot.snippet=content@s___t@{http://www.alfresco.org/model/content/1.0}content&spellcheck.collate=true)}\",\"_field_mappings_\":{},\"_date_mappings_\":{},\"_range_mappings_\":{},\"_pivot_mappings_\":{},\"_interval_mappings_\":{},\"_stats_field_mappings_\":{},\"_stats_facet_mappings_\":{},\"_facet_function_mappings_\":{},\"response\":{\"numFound\":6,\"start\":0,\"maxScore\":0.7849362,\"docs\":[{\"DBID\":565,\"score\":0.7849362},{\"DBID\":566,\"score\":0.7849362},{\"DBID\":521,\"score\":0.3540957},{\"DBID\":514,\"score\":0.33025497},{\"DBID\":420,\"score\":0.32440513},{\"DBID\":415,\"score\":0.2780319}]},"
|
||||
+ "\"spellcheck\":{\"searchInsteadFor\":\"alfresco\"},"
|
||||
+ "\"facet_counts\":{\"facet_queries\": {\"small\": 52,\"large\": 0,\"medium\": 0}},"
|
||||
+ "\"processedDenies\":true, \"lastIndexedTx\":34}";
|
||||
+ "\"spellcheck\":{\"searchInsteadFor\":\"alfresco\"},"
|
||||
+ "\"facet_counts\":{\"facet_queries\": {\"small\": 52,\"large\": 0,\"medium\": 0}},"
|
||||
+ "\"processedDenies\":true, \"lastIndexedTx\":34}";
|
||||
|
||||
ResultSet results = mockResultSet(expectedResponse);
|
||||
ResultSet results = mockResultset(expectedResponse);
|
||||
SearchQuery searchQuery = helper.extractFromJson(jsonQuery);
|
||||
SearchRequestContext searchRequest = SearchRequestContext.from(searchQuery);
|
||||
SearchContext searchContext = mapper.toSearchContext((SearchEngineResultSet) results, searchRequest, searchQuery);
|
||||
@@ -575,28 +587,28 @@ public class ResultMapperTests
|
||||
Metric[] metrics = searchContext.getFacets().get(0).getBuckets().get(0).getMetrics().toArray(new Metric[searchContext.getFacets().get(0).getBuckets().get(0).getMetrics().size()]);
|
||||
assertEquals(METRIC_TYPE.count, metrics[0].getType());
|
||||
assertEquals("{count=52}", metrics[0].getValue().toString());
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
/**
|
||||
* Test facet group with out facet fields
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
public void testFacetingGroupResponseV1()
|
||||
public void testFacetingGroupResponseV1() throws Exception
|
||||
{
|
||||
String jsonQuery = "{\"query\": {\"query\": \"alfresco\"}, \"facetFormat\":\"V1\","
|
||||
+ "\"facetQueries\": ["
|
||||
+ "\"facetQueries\": ["
|
||||
+ "{\"query\": \"content.size:[o TO 102400]\", \"label\": \"small\"},"
|
||||
+ "{\"query\": \"content.size:[102400 TO 1048576]\", \"label\": \"medium\",\"group\":\"foo\"},"
|
||||
+ "{\"query\": \"content.size:[102400 TO 1048576]\", \"label\": \"medium\",\"group\":\"foo\"},"
|
||||
+ "{\"query\": \"content.size:[1048576 TO 16777216]\", \"label\": \"large\"}]"
|
||||
+ "}";
|
||||
|
||||
|
||||
String expectedResponse = "{\"responseHeader\":{\"status\":0,\"QTime\":9},\"_original_parameters_\":\"org.apache.solr.common.params.DefaultSolrParams:{params(df=TEXT&alternativeDic=DEFAULT_DICTIONARY&fl=DBID,score&start=0&fq={!afts}AUTHORITY_FILTER_FROM_JSON&fq={!afts}TENANT_FILTER_FROM_JSON&rows=1000&locale=en_US&wt=json),defaults(carrot.url=id&spellcheck.collateExtendedResults=true&carrot.produceSummary=true&spellcheck.maxCollations=3&spellcheck.maxCollationTries=5&spellcheck.alternativeTermCount=2&spellcheck.extendedResults=false&defType=afts&spellcheck.maxResultsForSuggest=5&spellcheck=false&carrot.outputSubClusters=false&spellcheck.count=5&carrot.title=mltext@m___t@{http://www.alfresco.org/model/content/1.0}title&carrot.snippet=content@s___t@{http://www.alfresco.org/model/content/1.0}content&spellcheck.collate=true)}\",\"_field_mappings_\":{},\"_date_mappings_\":{},\"_range_mappings_\":{},\"_pivot_mappings_\":{},\"_interval_mappings_\":{},\"_stats_field_mappings_\":{},\"_stats_facet_mappings_\":{},\"_facet_function_mappings_\":{},\"response\":{\"numFound\":6,\"start\":0,\"maxScore\":0.7849362,\"docs\":[{\"DBID\":565,\"score\":0.7849362},{\"DBID\":566,\"score\":0.7849362},{\"DBID\":521,\"score\":0.3540957},{\"DBID\":514,\"score\":0.33025497},{\"DBID\":420,\"score\":0.32440513},{\"DBID\":415,\"score\":0.2780319}]},"
|
||||
+ "\"spellcheck\":{\"searchInsteadFor\":\"alfresco\"},"
|
||||
+ "\"facet_counts\":{\"facet_queries\": {\"small\": 52,\"large\": 0,\"medium\": 0}},"
|
||||
+ "\"processedDenies\":true, \"lastIndexedTx\":34}";
|
||||
|
||||
ResultSet results = mockResultSet(expectedResponse);
|
||||
ResultSet results = mockResultset(expectedResponse);
|
||||
SearchQuery searchQuery = helper.extractFromJson(jsonQuery);
|
||||
SearchRequestContext searchRequest = SearchRequestContext.from(searchQuery);
|
||||
SearchContext searchContext = mapper.toSearchContext((SearchEngineResultSet) results, searchRequest, searchQuery);
|
||||
@@ -610,15 +622,17 @@ public class ResultMapperTests
|
||||
Metric[] metrics = searchContext.getFacets().get(0).getBuckets().get(0).getMetrics().toArray(new Metric[searchContext.getFacets().get(0).getBuckets().get(0).getMetrics().size()]);
|
||||
assertEquals(METRIC_TYPE.count, metrics[0].getType());
|
||||
assertEquals("{count=52}", metrics[0].getValue().toString());
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
/**
|
||||
* Test facet fields with out group label in the query.
|
||||
* This is to support original api methods query for facet query.
|
||||
*
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
public void testFacetQueryWithoutGroupResponse()
|
||||
public void testFacetQueryWithoutGroupResponse() throws Exception
|
||||
{
|
||||
String jsonQuery = "{\"query\": {\"query\": \"alfresco\"},"
|
||||
+ "\"facetQueries\": ["
|
||||
@@ -632,7 +646,7 @@ public class ResultMapperTests
|
||||
+ "\"facet_counts\":{\"facet_queries\": {\"small\": 52,\"large\": 0,\"medium\": 0}},"
|
||||
+ "\"processedDenies\":true, \"lastIndexedTx\":34}";
|
||||
|
||||
ResultSet results = mockResultSet(expectedResponse);
|
||||
ResultSet results = mockResultset(expectedResponse);
|
||||
SearchQuery searchQuery = helper.extractFromJson(jsonQuery);
|
||||
SearchRequestContext searchRequest = SearchRequestContext.from(searchQuery);
|
||||
SearchContext searchContext = mapper.toSearchContext((SearchEngineResultSet) results, searchRequest, searchQuery);
|
||||
@@ -649,8 +663,7 @@ public class ResultMapperTests
|
||||
assertEquals("content.size:[102400 TO 1048576]",searchContext.getFacetQueries().get(2).getFilterQuery());
|
||||
assertEquals(0, searchContext.getFacetQueries().get(2).getCount());
|
||||
}
|
||||
|
||||
private ResultSet mockResultSet(String json)
|
||||
private ResultSet mockResultset(String json) throws Exception
|
||||
{
|
||||
NodeService nodeService = mock(NodeService.class);
|
||||
JSONObject jsonObj = new JSONObject(new JSONTokener(json));
|
||||
@@ -665,17 +678,19 @@ public class ResultMapperTests
|
||||
return results;
|
||||
}
|
||||
|
||||
private ResultSet mockResultSet(List<Long> archivedNodes, List<Long> versionNodes)
|
||||
private ResultSet mockResultset(List<Long> archivedNodes, List<Long> versionNodes) throws JSONException
|
||||
{
|
||||
|
||||
NodeService nodeService = mock(NodeService.class);
|
||||
when(nodeService.getNodeRef(any())).thenAnswer((Answer<NodeRef>) invocation ->
|
||||
{
|
||||
Object[] args = invocation.getArguments();
|
||||
//If the DBID is in the list archivedNodes, instead of returning a noderef return achivestore noderef
|
||||
if (archivedNodes.contains(args[0])) return new NodeRef(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE, GUID.generate());
|
||||
if (versionNodes.contains(args[0])) return new NodeRef(StoreMapper.STORE_REF_VERSION2_SPACESSTORE, GUID.generate()+args[0]);
|
||||
return new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, GUID.generate());
|
||||
when(nodeService.getNodeRef(any())).thenAnswer(new Answer<NodeRef>() {
|
||||
@Override
|
||||
public NodeRef answer(InvocationOnMock invocation) throws Throwable {
|
||||
Object[] args = invocation.getArguments();
|
||||
//If the DBID is in the list archivedNodes, instead of returning a noderef return achivestore noderef
|
||||
if (archivedNodes.contains(args[0])) return new NodeRef(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE, GUID.generate());
|
||||
if (versionNodes.contains(args[0])) return new NodeRef(StoreMapper.STORE_REF_VERSION2_SPACESSTORE, GUID.generate()+args[0]);
|
||||
return new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, GUID.generate());
|
||||
}
|
||||
});
|
||||
|
||||
SearchParameters sp = new SearchParameters();
|
||||
@@ -685,12 +700,12 @@ public class ResultMapperTests
|
||||
return results;
|
||||
}
|
||||
|
||||
@Test
|
||||
/**
|
||||
* Validates that when facetFormat is specified then all facets are returned
|
||||
* in the generic facet response format AKA V2.
|
||||
*/
|
||||
@Test
|
||||
public void facetFormatTest()
|
||||
public void facetFormatTest() throws Exception
|
||||
{
|
||||
String jsonQuery = "{\"query\": {\"query\": \"alfresco\"},"
|
||||
+ "\"facetQueries\": ["
|
||||
@@ -705,7 +720,7 @@ public class ResultMapperTests
|
||||
+ "\"facet_counts\":{\"facet_queries\": {\"small\": 52,\"large\": 0,\"medium\": 0}},"
|
||||
+ "\"processedDenies\":true, \"lastIndexedTx\":34}";
|
||||
|
||||
ResultSet results = mockResultSet(expectedResponse);
|
||||
ResultSet results = mockResultset(expectedResponse);
|
||||
SearchQuery searchQuery = helper.extractFromJson(jsonQuery);
|
||||
SearchRequestContext searchRequest = SearchRequestContext.from(searchQuery);
|
||||
SearchContext searchContext = mapper.toSearchContext((SearchEngineResultSet) results, searchRequest, searchQuery);
|
||||
@@ -722,7 +737,7 @@ public class ResultMapperTests
|
||||
|
||||
jsonQuery = jsonQuery.replace("V2", "V1");
|
||||
searchQuery = helper.extractFromJson(jsonQuery);
|
||||
results = mockResultSet(expectedResponse);
|
||||
results = mockResultset(expectedResponse);
|
||||
searchRequest = SearchRequestContext.from(searchQuery);
|
||||
searchContext = mapper.toSearchContext((SearchEngineResultSet) results, searchRequest, searchQuery);
|
||||
assertEquals(34l, searchContext.getConsistency().getlastTxId());
|
||||
@@ -743,7 +758,7 @@ public class ResultMapperTests
|
||||
+ "\"spellcheck\":{\"searchInsteadFor\":\"alfresco\"},"
|
||||
+ "\"facet_counts\":{\"facet_fields\":{\"creator\":[\"System\",124,\"mjackson\",11,\"abeecher\",4],\"modifier\":[\"System\",124,\"mjackson\",8,\"admin\",7]}},"
|
||||
+ "\"processedDenies\":true, \"lastIndexedTx\":34}";
|
||||
results = mockResultSet(expectedResponse);
|
||||
results = mockResultset(expectedResponse);
|
||||
searchQuery = helper.extractFromJson(jsonQuery);
|
||||
searchContext = mapper.toSearchContext((SearchEngineResultSet) results, searchRequest, searchQuery);
|
||||
assertFalse(searchContext.getFacetsFields().isEmpty());
|
||||
@@ -769,7 +784,7 @@ public class ResultMapperTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void hasGroupTest()
|
||||
public void hasGroupTest() throws IOException
|
||||
{
|
||||
String jsonQuery = "{\"query\": {\"query\": \"alfresco\"},"
|
||||
+ "\"facetQueries\": ["
|
||||
@@ -794,7 +809,7 @@ public class ResultMapperTests
|
||||
SearchQuery searchQuery3 = helper.extractFromJson(noFacetQueries);
|
||||
assertFalse(ResultMapper.hasGroup(searchQuery3));
|
||||
}
|
||||
|
||||
@Test
|
||||
/**
|
||||
* When the following is passed
|
||||
* "facetQueries": [
|
||||
@@ -802,9 +817,9 @@ public class ResultMapperTests
|
||||
* {"query": "content.size:[102400 TO 1048576]", "label": "medium", "group": "two"},
|
||||
* {"query": "content.size:[1048576 TO 16777216]", "label": "large"}
|
||||
* We expect to see 3 groups of 1,2,null.
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
public void testFacetingWithPartialGroup()
|
||||
public void testFacetingWithPartialGroup() throws Exception
|
||||
{
|
||||
String jsonQuery = "{\"query\": {\"query\": \"alfresco\"},"
|
||||
+ "\"facetQueries\": ["
|
||||
@@ -818,7 +833,7 @@ public class ResultMapperTests
|
||||
+ "\"facet_counts\":{\"facet_queries\": {\"small\": 52,\"large\": 0,\"medium\": 0}},"
|
||||
+ "\"processedDenies\":true, \"lastIndexedTx\":34}";
|
||||
|
||||
ResultSet results = mockResultSet(expectedResponse);
|
||||
ResultSet results = mockResultset(expectedResponse);
|
||||
SearchQuery searchQuery = helper.extractFromJson(jsonQuery);
|
||||
SearchRequestContext searchRequest = SearchRequestContext.from(searchQuery);
|
||||
SearchContext searchContext = mapper.toSearchContext((SearchEngineResultSet) results, searchRequest, searchQuery);
|
||||
@@ -838,9 +853,8 @@ public class ResultMapperTests
|
||||
assertEquals("{count=52}", metrics[0].getValue().toString());
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSqlResponse()
|
||||
public void testSqlResponse() throws IOException, JSONException
|
||||
{
|
||||
JSONObject response = new JSONObject("{\"docs\":[{\"SITE\":\"_REPOSITORY_\"},{\"SITE\":\"surf-config\"},{\"SITE\":\"swsdp\"},{\"EOF\":true,\"RESPONSE_TIME\":96}]}");
|
||||
JSONArray docs = response.getJSONArray("docs");
|
||||
@@ -874,18 +888,4 @@ public class ResultMapperTests
|
||||
assertEquals("SearchSQLQuery is required", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/** Check that when a node is returned from the index the permissions are still checked in the DB. */
|
||||
@Test
|
||||
public void testGetNode()
|
||||
{
|
||||
ResultSetRow mockRow = mock(ResultSetRow.class);
|
||||
NodeRef nodeRef = new NodeRef("workspace://SpacesStore/testNode");
|
||||
when(mockRow.getNodeRef()).thenReturn(nodeRef);
|
||||
when(nodes.getFolderOrDocument(eq(nodeRef), any(), any(), any(), any())).thenThrow(new PermissionDeniedException());
|
||||
|
||||
Node node = mapper.getNode(mockRow, EMPTY_PARAMS, null, false);
|
||||
|
||||
assertNull("Expected node to be filtered due to permission exception.", node);
|
||||
}
|
||||
}
|
||||
|
@@ -52,7 +52,7 @@ import java.io.StringReader;
|
||||
public class SerializerTestHelper implements RequestReader
|
||||
{
|
||||
|
||||
JacksonHelper jsonHelper;
|
||||
JacksonHelper jsonHelper = null;
|
||||
|
||||
public static final String JSON = "{ \"query\": {\"query\": \"g*\",\"userQuery\": \"great\",\"language\": \"afts\"}, "
|
||||
+ "\"paging\": {\"maxItems\": \"99\",\"skipCount\": \"4\"},"
|
||||
@@ -99,23 +99,16 @@ public class SerializerTestHelper implements RequestReader
|
||||
}
|
||||
}
|
||||
|
||||
public SearchQuery extractFromJson(String json)
|
||||
public SearchQuery extractFromJson(String json) throws IOException
|
||||
{
|
||||
Content content = mock(Content.class);
|
||||
try
|
||||
{
|
||||
when(content.getReader()).thenReturn(new StringReader(json));
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
throw new IllegalStateException("Unexpectedly received exception when configuring mock.", e);
|
||||
}
|
||||
when(content.getReader()).thenReturn(new StringReader(json));
|
||||
WebScriptRequest request = mock(WebScriptRequest.class);
|
||||
when(request.getContent()).thenReturn(content);
|
||||
return extractJsonContent(request, jsonHelper, SearchQuery.class);
|
||||
}
|
||||
|
||||
public SearchQuery searchQueryFromJson()
|
||||
public SearchQuery searchQueryFromJson() throws IOException
|
||||
{
|
||||
return extractFromJson(JSON);
|
||||
}
|
||||
|
@@ -26,26 +26,21 @@
|
||||
package org.alfresco.rest.api.tests;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.repo.admin.RepoHealthChecker;
|
||||
import org.alfresco.rest.api.discovery.DiscoveryApiWebscript;
|
||||
import org.alfresco.rest.api.probes.ProbeEntityResource;
|
||||
import org.alfresco.rest.api.tests.client.HttpResponse;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
|
||||
import static org.alfresco.rest.api.probes.ProbeEntityResource.*;
|
||||
import static org.alfresco.rest.api.probes.ProbeEntityResource.ProbeType.LIVE;
|
||||
import static org.alfresco.rest.api.probes.ProbeEntityResource.ProbeType.READY;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.mockito.Mockito.lenient;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
/**
|
||||
* V1 REST API tests for Probes (Live and Ready)
|
||||
@@ -58,6 +53,7 @@ import static org.mockito.Mockito.lenient;
|
||||
public class ProbeApiTest extends AbstractBaseApiTest
|
||||
{
|
||||
private static final boolean OK = true;
|
||||
private static final boolean ERROR = false;
|
||||
|
||||
private ProbeEntityResource probe;
|
||||
private DiscoveryApiWebscript origDiscovery;
|
||||
@@ -68,9 +64,6 @@ public class ProbeApiTest extends AbstractBaseApiTest
|
||||
@Mock
|
||||
private DiscoveryApiWebscript badDiscovery;
|
||||
|
||||
@Mock
|
||||
private RepoHealthChecker repoHealthChecker;
|
||||
|
||||
@Before
|
||||
@Override
|
||||
public void setup() throws Exception
|
||||
@@ -80,9 +73,7 @@ public class ProbeApiTest extends AbstractBaseApiTest
|
||||
|
||||
String beanName = ProbeEntityResource.class.getCanonicalName()+".get";
|
||||
probe = applicationContext.getBean(beanName, ProbeEntityResource.class);
|
||||
lenient().when(badDiscovery.getRepositoryInfo()).thenThrow(AlfrescoRuntimeException.class);
|
||||
Mockito.doNothing().when(repoHealthChecker).checkDatabase();
|
||||
probe.setRepoHealthChecker(repoHealthChecker);
|
||||
when(badDiscovery.getRepositoryInfo()).thenThrow(AlfrescoRuntimeException.class);
|
||||
origDiscovery = probe.setDiscovery(badDiscovery);
|
||||
}
|
||||
|
||||
@@ -100,7 +91,7 @@ public class ProbeApiTest extends AbstractBaseApiTest
|
||||
return "public";
|
||||
}
|
||||
|
||||
private void assertResponse(ProbeType probeType, Boolean ready, String expected, int expectedStatus) throws Exception
|
||||
private void assertResponse(String probeName, Boolean ready, String expected, int expectedStatus) throws Exception
|
||||
{
|
||||
String[] keys = expectedStatus == 200
|
||||
? new String[]{"entry", "message"}
|
||||
@@ -112,7 +103,7 @@ public class ProbeApiTest extends AbstractBaseApiTest
|
||||
? goodDiscovery
|
||||
: badDiscovery);
|
||||
|
||||
HttpResponse response = getSingle(ProbeEntityResource.class, probeType.getValue(), null, expectedStatus);
|
||||
HttpResponse response = getSingle(ProbeEntityResource.class, probeName, null, expectedStatus);
|
||||
Object object = response.getJsonResponse();
|
||||
for (String key: keys)
|
||||
{
|
||||
@@ -137,29 +128,32 @@ public class ProbeApiTest extends AbstractBaseApiTest
|
||||
public void testProbes() throws Exception
|
||||
{
|
||||
// Live first
|
||||
assertResponse(LIVE, OK, "liveProbe: Success - Tested", 200);
|
||||
assertResponse(READY, null, "readyProbe: Failure - Tested", 503);
|
||||
assertResponse(LIVE, ERROR, "liveProbe: Failure - Tested", 503);
|
||||
assertResponse(LIVE, null, "liveProbe: Failure - No test", 503); // Need to wait 10 seconds.
|
||||
assertResponse(LIVE, null, "liveProbe: Failure - No test", 503);
|
||||
assertResponse(READY, null, "readyProbe: Failure - No test", 503);
|
||||
|
||||
Thread.currentThread().sleep(CHECK_PERIOD);
|
||||
assertResponse(READY, OK, "readyProbe: Success - Tested", 200);
|
||||
assertResponse(LIVE, OK, "liveProbe: Success - Tested", 200);
|
||||
assertResponse(LIVE, null, "liveProbe: Success - No test", 200);
|
||||
assertResponse(READY, null, "readyProbe: Success - No test", 200);
|
||||
assertResponse(LIVE, null, "liveProbe: Success - No test", 200);
|
||||
|
||||
Thread.currentThread().sleep(CHECK_PERIOD);
|
||||
assertResponse(LIVE, OK, "liveProbe: Success - Tested", 200);
|
||||
assertResponse(READY, null, "readyProbe: Failure - Tested", 503);
|
||||
assertResponse(LIVE, ERROR, "liveProbe: Failure - Tested", 503);
|
||||
assertResponse(LIVE, null, "liveProbe: Failure - No test", 503);
|
||||
assertResponse(READY, null, "readyProbe: Failure - No test", 503);
|
||||
|
||||
|
||||
|
||||
// Ready first
|
||||
Thread.currentThread().sleep(CHECK_PERIOD);
|
||||
assertResponse(READY, OK, "readyProbe: Success - Tested", 200);
|
||||
assertResponse(LIVE, OK, "liveProbe: Success - Tested", 200);
|
||||
assertResponse(LIVE, null, "liveProbe: Success - No test", 200);
|
||||
assertResponse(READY, null, "readyProbe: Success - No test", 200);
|
||||
|
||||
// check db failure
|
||||
Thread.currentThread().sleep(CHECK_PERIOD);
|
||||
Mockito.doThrow(AlfrescoRuntimeException.class).when(repoHealthChecker).checkDatabase();
|
||||
assertResponse(READY, OK, "readyProbe: Failure - Tested", 503);
|
||||
assertResponse(READY, OK, "readyProbe: Failure - No test", 503);
|
||||
|
||||
assertResponse(READY, ERROR, "readyProbe: Failure - Tested", 503);
|
||||
assertResponse(LIVE, null, "liveProbe: Failure - No test", 503);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -60,11 +60,8 @@ import org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl;
|
||||
import org.alfresco.cmis.client.type.AlfrescoType;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.model.RenditionModel;
|
||||
import org.alfresco.opencmis.CMISDispatcher;
|
||||
import org.alfresco.opencmis.CMISDispatcherRegistry.Binding;
|
||||
import org.alfresco.opencmis.CMISServletDispatcher;
|
||||
import org.alfresco.opencmis.PublicApiAlfrescoCmisServiceFactory;
|
||||
import org.alfresco.opencmis.PublicApiBrowserCMISDispatcher;
|
||||
import org.alfresco.opencmis.dictionary.CMISStrictDictionaryService;
|
||||
import org.alfresco.opencmis.dictionary.QNameFilter;
|
||||
import org.alfresco.opencmis.dictionary.QNameFilterImpl;
|
||||
@@ -102,7 +99,6 @@ import org.alfresco.rest.api.tests.client.data.NodeRating.Aggregate;
|
||||
import org.alfresco.rest.api.tests.client.data.Person;
|
||||
import org.alfresco.rest.api.tests.client.data.SiteRole;
|
||||
import org.alfresco.rest.api.tests.client.data.Tag;
|
||||
import org.alfresco.rest.framework.core.exceptions.JsonpCallbackNotAllowedException;
|
||||
import org.alfresco.service.cmr.lock.LockService;
|
||||
import org.alfresco.service.cmr.lock.LockType;
|
||||
import org.alfresco.service.cmr.model.FileFolderService;
|
||||
@@ -157,7 +153,6 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.extensions.surf.util.I18NUtil;
|
||||
import org.springframework.extensions.surf.util.URLEncoder;
|
||||
|
||||
public class TestCMIS extends EnterpriseTestApi
|
||||
@@ -522,73 +517,6 @@ public class TestCMIS extends EnterpriseTestApi
|
||||
assertEquals(200, response.getStatusCode());
|
||||
}
|
||||
|
||||
/**
|
||||
* MNT-22428 Check the return from http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/browser/root&callback= when jsonp callback is disabled
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
public void testBrowserDisabledJSONPCallback() throws Exception
|
||||
{
|
||||
// disables unsecure callback jsonp
|
||||
final PublicApiBrowserCMISDispatcher dispatcher = ctx.getBean(PublicApiBrowserCMISDispatcher.class);
|
||||
dispatcher.setAllowUnsecureCallbackJSONP(false);
|
||||
|
||||
final TestNetwork network1 = getTestFixture().getRandomNetwork();
|
||||
Iterator<String> personIt = network1.getPersonIds().iterator();
|
||||
final String personId = personIt.next();
|
||||
assertNotNull(personId);
|
||||
Person person = repoService.getPerson(personId);
|
||||
assertNotNull(person);
|
||||
|
||||
publicApiClient.setRequestContext(new RequestContext(network1.getId(), personId));
|
||||
|
||||
// request with a callback parameter
|
||||
HttpResponse response;
|
||||
final Map<String, String> params = Map.of("callback", "");
|
||||
response = publicApiClient.get(network1.getId() + "/public/cmis/versions/1.1/browser/root", params);
|
||||
assertEquals(403, response.getStatusCode());
|
||||
|
||||
String exceptionMessage = I18NUtil.getMessage(JsonpCallbackNotAllowedException.DEFAULT_MESSAGE_ID, params);
|
||||
assertTrue(response.getResponse().endsWith(exceptionMessage));
|
||||
|
||||
// request without a callback parameter
|
||||
response = publicApiClient.get(network1.getId() + "/public/cmis/versions/1.1/browser/root", null);
|
||||
assertEquals(200, response.getStatusCode());
|
||||
}
|
||||
|
||||
/*
|
||||
* MNT-22428 Check the return from http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/browser/root&callback= when jsonp callback is enabled
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
public void testBrowserEnabledJSONPCallback() throws Exception
|
||||
{
|
||||
// enables unsecure callback jsonp
|
||||
final PublicApiBrowserCMISDispatcher dispatcher = ctx.getBean(PublicApiBrowserCMISDispatcher.class);
|
||||
dispatcher.setAllowUnsecureCallbackJSONP(true);
|
||||
|
||||
final TestNetwork network1 = getTestFixture().getRandomNetwork();
|
||||
Iterator<String> personIt = network1.getPersonIds().iterator();
|
||||
final String personId = personIt.next();
|
||||
assertNotNull(personId);
|
||||
Person person = repoService.getPerson(personId);
|
||||
assertNotNull(person);
|
||||
|
||||
publicApiClient.setRequestContext(new RequestContext(network1.getId(), personId));
|
||||
|
||||
// request with a callback parameter
|
||||
HttpResponse response;
|
||||
final Map<String, String> params = Map.of("callback", "someFunction");
|
||||
response = publicApiClient.get(network1.getId() + "/public/cmis/versions/1.1/browser/root", params);
|
||||
assertEquals(200, response.getStatusCode());
|
||||
|
||||
// request without a callback parameter
|
||||
response = publicApiClient.get(network1.getId() + "/public/cmis/versions/1.1/browser/root", null);
|
||||
assertEquals(200, response.getStatusCode());
|
||||
}
|
||||
|
||||
/**
|
||||
* REPO-2041 / MNT-16236 Upload via cmis binding atom and browser files with different maxContentSize
|
||||
*/
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
<version>12.10</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
@@ -191,7 +191,7 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-artifact</artifactId>
|
||||
<version>${dependency.maven-artifact.version}</version>
|
||||
<version>3.8.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>de.schlichtherle.truezip</groupId>
|
||||
|
@@ -1,28 +1,28 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* 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
|
||||
* 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%
|
||||
*/
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* 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
|
||||
* 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.encryption;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -241,12 +241,6 @@ public class ReEncryptor implements ApplicationContextAware
|
||||
return properties.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getTotalEstimatedWorkSizeLong()
|
||||
{
|
||||
return properties.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<NodePropertyEntity> getNextWork()
|
||||
{
|
||||
|
@@ -1959,12 +1959,6 @@ public class AlfrescoCmisServiceImpl extends AbstractCmisService implements Alfr
|
||||
return size;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized long getTotalEstimatedWorkSizeLong()
|
||||
{
|
||||
return size;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized Collection<BulkEntry> getNextWork()
|
||||
{
|
||||
|
@@ -1,28 +1,28 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* 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
|
||||
* 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%
|
||||
*/
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* 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
|
||||
* 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.activities.feed;
|
||||
|
||||
import java.util.Collection;
|
||||
@@ -427,12 +427,6 @@ public class FeedNotifierImpl implements FeedNotifier, ApplicationContextAware
|
||||
return personService.countPeople();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getTotalEstimatedWorkSizeLong()
|
||||
{
|
||||
return personService.countPeople();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<PersonInfo> getNextWork()
|
||||
{
|
||||
|
@@ -1,28 +1,28 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* 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
|
||||
* 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%
|
||||
*/
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* 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
|
||||
* 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.activities.feed.local;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -155,25 +155,13 @@ public class LocalFeedGenerator extends AbstractFeedGenerator
|
||||
|
||||
@Override
|
||||
public int getTotalEstimatedWorkSize()
|
||||
{
|
||||
return (int) calculateEstimatedWorkSize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getTotalEstimatedWorkSizeLong()
|
||||
{
|
||||
return calculateEstimatedWorkSize();
|
||||
}
|
||||
|
||||
private long calculateEstimatedWorkSize()
|
||||
{
|
||||
long size = maxSequence - minSequence + 1;
|
||||
long remain = size % batchSize;
|
||||
long workSize = (remain == 0) ? (size / batchSize) : (size / batchSize + 1);
|
||||
return workSize;
|
||||
return (int) workSize;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Collection<JobSettings> getNextWork()
|
||||
{
|
||||
|
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Remote API
|
||||
* %%
|
||||
* 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
|
||||
* 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.admin;
|
||||
|
||||
import org.alfresco.repo.domain.schema.DataSourceCheck;
|
||||
|
||||
/**
|
||||
* A utility service to do the database and other health checks.
|
||||
*/
|
||||
public class RepoHealthChecker
|
||||
{
|
||||
private final DataSourceCheck dataSourceCheck;
|
||||
|
||||
public RepoHealthChecker(DataSourceCheck dataSourceCheck)
|
||||
{
|
||||
this.dataSourceCheck = dataSourceCheck;
|
||||
}
|
||||
|
||||
public void checkDatabase()
|
||||
{
|
||||
dataSourceCheck.init();
|
||||
}
|
||||
|
||||
}
|
@@ -1,28 +1,28 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* 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
|
||||
* 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%
|
||||
*/
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* 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
|
||||
* 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.admin.patch;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
@@ -486,11 +486,6 @@ public abstract class AbstractPatch implements Patch, ApplicationEventPublisher
|
||||
return tenants.size();
|
||||
}
|
||||
|
||||
public long getTotalEstimatedWorkSizeLong()
|
||||
{
|
||||
return tenants.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Tenant> getNextWork()
|
||||
{
|
||||
@@ -559,13 +554,13 @@ public abstract class AbstractPatch implements Patch, ApplicationEventPublisher
|
||||
logger.debug("batch worker finished processing id:" + id);
|
||||
}
|
||||
|
||||
if (batchProcessor.getTotalErrorsLong() > 0)
|
||||
if (batchProcessor.getTotalErrors() > 0)
|
||||
{
|
||||
sb.append("\n" + " and failure during update of tennants total success: " + batchProcessor.getSuccessfullyProcessedEntriesLong() + " number of errors: " +batchProcessor.getTotalErrorsLong() + " lastError" + batchProcessor.getLastError());
|
||||
sb.append("\n" + " and failure during update of tennants total success: " + batchProcessor.getSuccessfullyProcessedEntries() + " number of errors: " +batchProcessor.getTotalErrors() + " lastError" + batchProcessor.getLastError());
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.append("\n" + " and successful batch update of " + batchProcessor.getTotalResultsLong() + "tennants");
|
||||
sb.append("\n" + " and successful batch update of " + batchProcessor.getTotalResults() + "tennants");
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,28 +1,28 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* 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
|
||||
* 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%
|
||||
*/
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* 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
|
||||
* 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.admin.patch.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -90,12 +90,6 @@ public class AddUnmovableAspectToSitesPatch extends AsynchronousPatch
|
||||
return sites.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getTotalEstimatedWorkSizeLong()
|
||||
{
|
||||
return sites.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ChildAssociationRef> getNextWork()
|
||||
{
|
||||
|
@@ -1,28 +1,28 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* 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
|
||||
* 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%
|
||||
*/
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* 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
|
||||
* 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.admin.patch.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -93,11 +93,6 @@ public class AliasableAspectPatch extends AbstractPatch
|
||||
return result.size();
|
||||
}
|
||||
|
||||
public long getTotalEstimatedWorkSizeLong()
|
||||
{
|
||||
return result.size();
|
||||
}
|
||||
|
||||
public Collection<NodeRef> getNextWork()
|
||||
{
|
||||
if(val != null)
|
||||
|
@@ -237,12 +237,6 @@ public class FixBpmPackagesPatch extends AbstractPatch
|
||||
return assocCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized long getTotalEstimatedWorkSizeLong()
|
||||
{
|
||||
return assocCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized Collection<ChildAssociationRef> getNextWork()
|
||||
{
|
||||
|
@@ -1,28 +1,28 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* 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
|
||||
* 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%
|
||||
*/
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* 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
|
||||
* 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.admin.patch.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -76,11 +76,6 @@ public class ImapUnsubscribedAspectPatch extends AbstractPatch
|
||||
return result.size();
|
||||
}
|
||||
|
||||
public long getTotalEstimatedWorkSizeLong()
|
||||
{
|
||||
return result.size();
|
||||
}
|
||||
|
||||
public Collection<NodeRef> getNextWork()
|
||||
{
|
||||
result.clear();
|
||||
|
@@ -1,28 +1,28 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* 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
|
||||
* 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%
|
||||
*/
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* 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
|
||||
* 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.admin.patch.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -143,12 +143,6 @@ public class RenameSiteAuthorityDisplayName extends AbstractPatch
|
||||
{
|
||||
return siteInfos.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getTotalEstimatedWorkSizeLong()
|
||||
{
|
||||
return siteInfos.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<SiteInfo> getNextWork()
|
||||
|
@@ -1,31 +1,37 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* 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
|
||||
* 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%
|
||||
*/
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* 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
|
||||
* 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.admin.patch.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.admin.patch.AsynchronousPatch;
|
||||
import org.alfresco.repo.admin.patch.PatchExecuter;
|
||||
@@ -49,12 +55,6 @@ import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.extensions.surf.util.I18NUtil;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Patch to add <i>cm:indexControl</i> aspect to sites' surf-config folders and
|
||||
* their children as well as to the shared surf-config folder(s) and its/their children.
|
||||
@@ -382,12 +382,8 @@ public class SurfConfigFolderPatch extends AsynchronousPatch
|
||||
this.siteTypeQNameId = qnameDAO.getQName(SiteModel.TYPE_SITE);
|
||||
}
|
||||
|
||||
@Override public synchronized int getTotalEstimatedWorkSize()
|
||||
{
|
||||
return (int) getTotalEstimatedWorkSizeLong();
|
||||
}
|
||||
|
||||
@Override public synchronized long getTotalEstimatedWorkSizeLong()
|
||||
@Override
|
||||
public synchronized int getTotalEstimatedWorkSize()
|
||||
{
|
||||
if (maxId == Long.MAX_VALUE)
|
||||
{
|
||||
@@ -409,7 +405,7 @@ public class SurfConfigFolderPatch extends AsynchronousPatch
|
||||
logger.debug("\tQ: Work count: " + workCount);
|
||||
}
|
||||
}
|
||||
return workCount;
|
||||
return (int) workCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -453,12 +449,6 @@ public class SurfConfigFolderPatch extends AsynchronousPatch
|
||||
|
||||
@Override
|
||||
public synchronized int getTotalEstimatedWorkSize()
|
||||
{
|
||||
return (int)getTotalEstimatedWorkSizeLong();
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized long getTotalEstimatedWorkSizeLong()
|
||||
{
|
||||
if (maxId == Long.MAX_VALUE)
|
||||
{
|
||||
@@ -469,7 +459,6 @@ public class SurfConfigFolderPatch extends AsynchronousPatch
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -1,28 +1,28 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* 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
|
||||
* 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%
|
||||
*/
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* 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
|
||||
* 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.batch;
|
||||
|
||||
import java.util.Date;
|
||||
@@ -50,10 +50,10 @@ public interface BatchMonitor
|
||||
|
||||
/**
|
||||
* Gets the total number of results.
|
||||
* @deprecated use {@link #getTotalResultsLong()} instead
|
||||
*
|
||||
* @return the total number of results
|
||||
*/
|
||||
@Deprecated public int getTotalResults();
|
||||
public int getTotalResults();
|
||||
|
||||
/**
|
||||
* Gets the ID of the entry being processed
|
||||
@@ -64,10 +64,10 @@ public interface BatchMonitor
|
||||
|
||||
/**
|
||||
* Gets the number of successfully processed entries.
|
||||
* @deprecated use {@link #getSuccessfullyProcessedEntriesLong()} instead
|
||||
*
|
||||
* @return the successfully processed entries
|
||||
*/
|
||||
@Deprecated public int getSuccessfullyProcessedEntries();
|
||||
public int getSuccessfullyProcessedEntries();
|
||||
|
||||
/**
|
||||
* Gets the progress expressed as a percentage.
|
||||
@@ -78,10 +78,10 @@ public interface BatchMonitor
|
||||
|
||||
/**
|
||||
* Gets the total number of errors.
|
||||
* @deprecated use {@link #getTotalErrorsLong()} instead
|
||||
*
|
||||
* @return the total number of errors
|
||||
*/
|
||||
@Deprecated public int getTotalErrors();
|
||||
public int getTotalErrors();
|
||||
|
||||
/**
|
||||
* Gets the stack trace of the last error.
|
||||
@@ -103,35 +103,4 @@ public interface BatchMonitor
|
||||
* @return the end time
|
||||
*/
|
||||
public Date getEndTime();
|
||||
|
||||
/**
|
||||
* Gets the total number of results.
|
||||
*
|
||||
* @return the total number of results
|
||||
*/
|
||||
public default long getTotalResultsLong()
|
||||
{
|
||||
throw new UnsupportedOperationException("getTotalResultsLong need to be implemented");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the total number of errors.
|
||||
*
|
||||
* @return the total number of errors
|
||||
*/
|
||||
public default long getTotalErrorsLong()
|
||||
{
|
||||
throw new UnsupportedOperationException("getTotalErrorsLong need to be implemented");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the number of successfully processed entries.
|
||||
*
|
||||
* @return the successfully processed entries
|
||||
*/
|
||||
public default long getSuccessfullyProcessedEntriesLong()
|
||||
{
|
||||
throw new UnsupportedOperationException("getSuccessfullyProcessedEntriesLong need to be implemented");
|
||||
}
|
||||
}
|
||||
|
@@ -43,10 +43,10 @@ public interface BatchProcessWorkProvider<T>
|
||||
* Instances can provide accurate answers on each call, but only if the answer can be
|
||||
* provided quickly and efficiently; usually it is enough to to cache the result after
|
||||
* providing an initial estimate.
|
||||
* @deprecated use {@link #getTotalEstimatedWorkSizeLong()} instead.
|
||||
*
|
||||
* @return a total work size estimate
|
||||
*/
|
||||
@Deprecated int getTotalEstimatedWorkSize();
|
||||
int getTotalEstimatedWorkSize();
|
||||
|
||||
/**
|
||||
* Get the next lot of work for the batch processor. Implementations should return
|
||||
@@ -58,18 +58,4 @@ public interface BatchProcessWorkProvider<T>
|
||||
* if there is no more work remaining.
|
||||
*/
|
||||
Collection<T> getNextWork();
|
||||
|
||||
/**
|
||||
* Get an estimate of the total number of objects that will be provided by this instance.
|
||||
* Instances can provide accurate answers on each call, but only if the answer can be
|
||||
* provided quickly and efficiently; usually it is enough to to cache the result after
|
||||
* providing an initial estimate.
|
||||
*
|
||||
* @return a total work size estimate
|
||||
*/
|
||||
default long getTotalEstimatedWorkSizeLong()
|
||||
{
|
||||
throw new UnsupportedOperationException("getTotalEstimatedWorkSizeLong need to implemented");
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -25,18 +25,6 @@
|
||||
*/
|
||||
package org.alfresco.repo.batch;
|
||||
|
||||
import org.alfresco.api.AlfrescoPublicApi;
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.repo.node.integrity.IntegrityException;
|
||||
import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.util.TraceableThreadFactory;
|
||||
import org.alfresco.util.transaction.TransactionListenerAdapter;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.io.Writer;
|
||||
@@ -55,6 +43,18 @@ import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.alfresco.api.AlfrescoPublicApi;
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.repo.node.integrity.IntegrityException;
|
||||
import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.util.TraceableThreadFactory;
|
||||
import org.alfresco.util.transaction.TransactionListenerAdapter;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
|
||||
/**
|
||||
* A <code>BatchProcessor</code> manages the running and monitoring of a potentially long-running transactional batch
|
||||
* process. It iterates over a collection, and queues jobs that fire a worker on a batch of members. The queued jobs
|
||||
@@ -110,10 +110,10 @@ public class BatchProcessor<T> implements BatchMonitor
|
||||
private String lastErrorEntryId;
|
||||
|
||||
/** The total number of errors. */
|
||||
private long totalErrors;
|
||||
private int totalErrors;
|
||||
|
||||
/** The number of successfully processed entries. */
|
||||
private long successfullyProcessedEntries;
|
||||
private int successfullyProcessedEntries;
|
||||
|
||||
/** The start time. */
|
||||
private Date startTime;
|
||||
@@ -158,17 +158,10 @@ public class BatchProcessor<T> implements BatchMonitor
|
||||
new BatchProcessWorkProvider<T>()
|
||||
{
|
||||
boolean hasMore = true;
|
||||
|
||||
@Override public int getTotalEstimatedWorkSize()
|
||||
{
|
||||
return (int) getTotalEstimatedWorkSizeLong();
|
||||
}
|
||||
|
||||
@Override public long getTotalEstimatedWorkSizeLong()
|
||||
public int getTotalEstimatedWorkSize()
|
||||
{
|
||||
return collection.size();
|
||||
}
|
||||
|
||||
public Collection<T> getNextWork()
|
||||
{
|
||||
// Only return the collection once
|
||||
@@ -287,15 +280,7 @@ public class BatchProcessor<T> implements BatchMonitor
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Deprecated public synchronized int getSuccessfullyProcessedEntries()
|
||||
{
|
||||
return Math.toIntExact(this.successfullyProcessedEntries);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public synchronized long getSuccessfullyProcessedEntriesLong()
|
||||
public synchronized int getSuccessfullyProcessedEntries()
|
||||
{
|
||||
return this.successfullyProcessedEntries;
|
||||
}
|
||||
@@ -305,8 +290,8 @@ public class BatchProcessor<T> implements BatchMonitor
|
||||
*/
|
||||
public synchronized String getPercentComplete()
|
||||
{
|
||||
long totalResults = this.workProvider.getTotalEstimatedWorkSizeLong();
|
||||
long processed = this.successfullyProcessedEntries + this.totalErrors;
|
||||
int totalResults = this.workProvider.getTotalEstimatedWorkSize();
|
||||
int processed = this.successfullyProcessedEntries + this.totalErrors;
|
||||
return processed <= totalResults ? NumberFormat.getPercentInstance().format(
|
||||
totalResults == 0 ? 1.0F : (float) processed / totalResults) : "Unknown";
|
||||
}
|
||||
@@ -314,23 +299,7 @@ public class BatchProcessor<T> implements BatchMonitor
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Deprecated public synchronized int getTotalErrors()
|
||||
{
|
||||
return Math.toIntExact(this.totalErrors);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Deprecated public int getTotalResults()
|
||||
{
|
||||
return this.workProvider.getTotalEstimatedWorkSize();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public synchronized long getTotalErrorsLong()
|
||||
public synchronized int getTotalErrors()
|
||||
{
|
||||
return this.totalErrors;
|
||||
}
|
||||
@@ -338,9 +307,9 @@ public class BatchProcessor<T> implements BatchMonitor
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public long getTotalResultsLong()
|
||||
public int getTotalResults()
|
||||
{
|
||||
return this.workProvider.getTotalEstimatedWorkSizeLong();
|
||||
return this.workProvider.getTotalEstimatedWorkSize();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -371,42 +340,12 @@ public class BatchProcessor<T> implements BatchMonitor
|
||||
* increased performance. If <code>false</code>, all invocations are performed in the current
|
||||
* transaction. This is required if calling synchronously (e.g. in response to an authentication event in
|
||||
* the same transaction).
|
||||
* @deprecated use {@link #processLong(BatchProcessWorker, boolean)} instead
|
||||
* @return the number of invocations
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
@Deprecated public int process(final BatchProcessWorker<T> worker, final boolean splitTxns)
|
||||
public int process(final BatchProcessWorker<T> worker, final boolean splitTxns)
|
||||
{
|
||||
int count = workProvider.getTotalEstimatedWorkSize();
|
||||
return (int)process(worker, splitTxns, count);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Invokes the worker for each entry in the collection, managing transactions and collating success / failure
|
||||
* information.
|
||||
*
|
||||
* @param worker
|
||||
* the worker
|
||||
* @param splitTxns
|
||||
* Can the modifications to Alfresco be split across multiple transactions for maximum performance? If
|
||||
* <code>true</code>, worker invocations are isolated in separate transactions in batches for
|
||||
* increased performance. If <code>false</code>, all invocations are performed in the current
|
||||
* transaction. This is required if calling synchronously (e.g. in response to an authentication event in
|
||||
* the same transaction).
|
||||
* @return the number of invocations
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public long processLong(final BatchProcessWorker<T> worker, final boolean splitTxns)
|
||||
{
|
||||
long count = workProvider.getTotalEstimatedWorkSizeLong();
|
||||
return process(worker, splitTxns, count);
|
||||
|
||||
}
|
||||
|
||||
|
||||
private long process(final BatchProcessWorker<T> worker, final boolean splitTxns, long count)
|
||||
{
|
||||
synchronized (this)
|
||||
{
|
||||
this.startTime = new Date();
|
||||
@@ -426,27 +365,27 @@ public class BatchProcessor<T> implements BatchMonitor
|
||||
|
||||
// Create a thread pool executor with the specified number of threads and a finite blocking queue of jobs
|
||||
ExecutorService executorService = splitTxns && this.workerThreads > 1 ?
|
||||
new ThreadPoolExecutor(
|
||||
this.workerThreads, this.workerThreads, 0L, TimeUnit.MILLISECONDS,
|
||||
new ArrayBlockingQueue<Runnable>(this.workerThreads * this.batchSize * 10)
|
||||
{
|
||||
// Add blocking behaviour to work queue
|
||||
@Override
|
||||
public boolean offer(Runnable o)
|
||||
{
|
||||
try
|
||||
{
|
||||
put(o);
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
new ThreadPoolExecutor(
|
||||
this.workerThreads, this.workerThreads, 0L, TimeUnit.MILLISECONDS,
|
||||
new ArrayBlockingQueue<Runnable>(this.workerThreads * this.batchSize * 10)
|
||||
{
|
||||
// Add blocking behaviour to work queue
|
||||
@Override
|
||||
public boolean offer(Runnable o)
|
||||
{
|
||||
try
|
||||
{
|
||||
put(o);
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
},
|
||||
threadFactory) : null;
|
||||
},
|
||||
threadFactory) : null;
|
||||
try
|
||||
{
|
||||
Iterator<T> iterator = new WorkProviderIterator<T>(this.workProvider);
|
||||
@@ -463,7 +402,7 @@ public class BatchProcessor<T> implements BatchMonitor
|
||||
{
|
||||
batch = new ArrayList<T>(this.batchSize);
|
||||
}
|
||||
|
||||
|
||||
if (executorService == null)
|
||||
{
|
||||
callback.run();
|
||||
@@ -508,12 +447,13 @@ public class BatchProcessor<T> implements BatchMonitor
|
||||
if (this.totalErrors > 0 && this.logger.isErrorEnabled())
|
||||
{
|
||||
this.logger.error(getProcessName() + ": " + this.totalErrors
|
||||
+ " error(s) detected. Last error from entry \"" + this.lastErrorEntryId + "\"",
|
||||
this.lastError);
|
||||
+ " error(s) detected. Last error from entry \"" + this.lastErrorEntryId + "\"",
|
||||
this.lastError);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reports the current progress.
|
||||
*
|
||||
@@ -524,20 +464,12 @@ public class BatchProcessor<T> implements BatchMonitor
|
||||
*/
|
||||
private synchronized void reportProgress(boolean last)
|
||||
{
|
||||
long processed = this.successfullyProcessedEntries + this.totalErrors;
|
||||
int processed = this.successfullyProcessedEntries + this.totalErrors;
|
||||
if (processed % this.loggingInterval == 0 ^ last)
|
||||
{
|
||||
StringBuilder message = new StringBuilder(100).append(getProcessName()).append(": Processed ").append(
|
||||
processed).append(" entries");
|
||||
long totalResults = 0;
|
||||
try
|
||||
{
|
||||
totalResults = this.workProvider.getTotalEstimatedWorkSizeLong();
|
||||
}
|
||||
catch (UnsupportedOperationException uoe)
|
||||
{
|
||||
totalResults = this.workProvider.getTotalEstimatedWorkSize();
|
||||
}
|
||||
int totalResults = this.workProvider.getTotalEstimatedWorkSize();
|
||||
if (totalResults >= processed)
|
||||
{
|
||||
message.append(" out of ").append(totalResults).append(". ").append(
|
||||
@@ -898,11 +830,11 @@ public class BatchProcessor<T> implements BatchMonitor
|
||||
{
|
||||
if (this.txnErrors > 0)
|
||||
{
|
||||
long processed = BatchProcessor.this.successfullyProcessedEntries + BatchProcessor.this.totalErrors;
|
||||
long currentIncrement = processed % BatchProcessor.this.loggingInterval;
|
||||
long newErrors = BatchProcessor.this.totalErrors + this.txnErrors;
|
||||
int processed = BatchProcessor.this.successfullyProcessedEntries + BatchProcessor.this.totalErrors;
|
||||
int currentIncrement = processed % BatchProcessor.this.loggingInterval;
|
||||
int newErrors = BatchProcessor.this.totalErrors + this.txnErrors;
|
||||
// Work out the number of logging intervals we will cross and report them
|
||||
long intervals = (this.txnErrors + currentIncrement) / BatchProcessor.this.loggingInterval;
|
||||
int intervals = (this.txnErrors + currentIncrement) / BatchProcessor.this.loggingInterval;
|
||||
if (intervals > 0)
|
||||
{
|
||||
BatchProcessor.this.totalErrors += BatchProcessor.this.loggingInterval - currentIncrement;
|
||||
@@ -918,11 +850,11 @@ public class BatchProcessor<T> implements BatchMonitor
|
||||
|
||||
if (this.txnSuccesses > 0)
|
||||
{
|
||||
long processed = BatchProcessor.this.successfullyProcessedEntries + BatchProcessor.this.totalErrors;
|
||||
long currentIncrement = processed % BatchProcessor.this.loggingInterval;
|
||||
long newSuccess = BatchProcessor.this.successfullyProcessedEntries + this.txnSuccesses;
|
||||
int processed = BatchProcessor.this.successfullyProcessedEntries + BatchProcessor.this.totalErrors;
|
||||
int currentIncrement = processed % BatchProcessor.this.loggingInterval;
|
||||
int newSuccess = BatchProcessor.this.successfullyProcessedEntries + this.txnSuccesses;
|
||||
// Work out the number of logging intervals we will cross and report them
|
||||
long intervals = (this.txnSuccesses + currentIncrement) / BatchProcessor.this.loggingInterval;
|
||||
int intervals = (this.txnSuccesses + currentIncrement) / BatchProcessor.this.loggingInterval;
|
||||
if (intervals > 0)
|
||||
{
|
||||
BatchProcessor.this.successfullyProcessedEntries += BatchProcessor.this.loggingInterval
|
||||
|
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* 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
|
||||
* 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,
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* 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
|
||||
* 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.
|
||||
@@ -195,12 +195,6 @@ public class StripingFilesystemTracker extends AbstractFilesystemTracker
|
||||
return count();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getTotalEstimatedWorkSizeLong()
|
||||
{
|
||||
return count();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ImportableItem> getNextWork()
|
||||
{
|
||||
|
@@ -1,47 +1,44 @@
|
||||
/*
|
||||
* #%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%
|
||||
*/
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* 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
|
||||
* 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;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.repo.cache.SimpleCache;
|
||||
import org.alfresco.service.Experimental;
|
||||
import org.alfresco.service.cmr.repository.ContentIOException;
|
||||
import org.alfresco.service.cmr.repository.ContentReader;
|
||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||
import org.alfresco.util.GUID;
|
||||
import org.alfresco.util.Pair;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.repo.cache.SimpleCache;
|
||||
import org.alfresco.service.cmr.repository.ContentIOException;
|
||||
import org.alfresco.service.cmr.repository.ContentReader;
|
||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||
import org.alfresco.util.GUID;
|
||||
import org.alfresco.util.Pair;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* A store providing support for content store implementations that provide
|
||||
@@ -419,24 +416,4 @@ public abstract class AbstractRoutingContentStore implements ContentStore
|
||||
}
|
||||
return deleted;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Experimental
|
||||
public Map<String, String> getStorageProperties(String contentUrl) {
|
||||
ContentStore contentStore = selectReadStore(contentUrl);
|
||||
|
||||
if (contentStore == null) {
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Storage properties not found for content URL: " + contentUrl);
|
||||
}
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Getting storage properties from store: \n" +
|
||||
" Content URL: " + contentUrl + "\n" +
|
||||
" Store: " + contentStore);
|
||||
}
|
||||
|
||||
return contentStore.getStorageProperties(contentUrl);
|
||||
}
|
||||
}
|
||||
|
@@ -45,7 +45,6 @@ import org.alfresco.repo.policy.ClassPolicyDelegate;
|
||||
import org.alfresco.repo.policy.JavaBehaviour;
|
||||
import org.alfresco.repo.policy.PolicyComponent;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
||||
import org.alfresco.service.Experimental;
|
||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.dictionary.InvalidTypeException;
|
||||
@@ -606,7 +605,7 @@ public class ContentServiceImpl implements ContentService, ApplicationContextAwa
|
||||
throw new IllegalArgumentException("The supplied nodeRef " + nodeRef + " has no content.");
|
||||
}
|
||||
|
||||
contentDirectUrlEnabled = (store.isContentDirectUrlEnabled(contentData.getContentUrl()));
|
||||
contentDirectUrlEnabled = (store.isContentDirectUrlEnabled(getContentUrl(nodeRef)));
|
||||
}
|
||||
|
||||
return contentDirectUrlEnabled;
|
||||
@@ -622,17 +621,8 @@ public class ContentServiceImpl implements ContentService, ApplicationContextAwa
|
||||
throw new DirectAccessUrlDisabledException("Direct access url isn't available.");
|
||||
}
|
||||
|
||||
ContentData contentData = getContentData(nodeRef, ContentModel.PROP_CONTENT);
|
||||
// check that the content & URL is available
|
||||
if (contentData == null || contentData.getContentUrl() == null)
|
||||
{
|
||||
throw new IllegalArgumentException("The supplied nodeRef " + nodeRef + " has no content.");
|
||||
}
|
||||
|
||||
String contentUrl = contentData.getContentUrl();
|
||||
String contentMimetype = contentData.getMimetype();
|
||||
String contentUrl = getContentUrl(nodeRef);
|
||||
String fileName = getFileName(nodeRef);
|
||||
|
||||
validFor = adjustValidFor(validFor);
|
||||
|
||||
DirectAccessUrl directAccessUrl = null;
|
||||
@@ -640,7 +630,7 @@ public class ContentServiceImpl implements ContentService, ApplicationContextAwa
|
||||
{
|
||||
try
|
||||
{
|
||||
directAccessUrl = store.requestContentDirectUrl(contentUrl, attachment, fileName, contentMimetype, validFor);
|
||||
directAccessUrl = store.requestContentDirectUrl(contentUrl, attachment, fileName, validFor);
|
||||
}
|
||||
catch (UnsupportedOperationException ex)
|
||||
{
|
||||
@@ -650,21 +640,17 @@ public class ContentServiceImpl implements ContentService, ApplicationContextAwa
|
||||
return directAccessUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
@Experimental
|
||||
public Map<String, String> getStorageProperties(NodeRef nodeRef, QName propertyQName)
|
||||
protected String getContentUrl(NodeRef nodeRef)
|
||||
{
|
||||
final ContentData contentData = getContentData(nodeRef, propertyQName);
|
||||
ContentData contentData = getContentData(nodeRef, ContentModel.PROP_CONTENT);
|
||||
|
||||
// check that the URL is available
|
||||
if (contentData == null || contentData.getContentUrl() == null)
|
||||
{
|
||||
throw new IllegalArgumentException("The supplied nodeRef " + nodeRef + " and property name: " + propertyQName + " has no content.");
|
||||
throw new IllegalArgumentException("The supplied nodeRef " + nodeRef + " has no content.");
|
||||
}
|
||||
|
||||
return store.getStorageProperties(contentData.getContentUrl());
|
||||
return contentData.getContentUrl();
|
||||
}
|
||||
|
||||
protected String getFileName(NodeRef nodeRef)
|
||||
@@ -690,4 +676,4 @@ public class ContentServiceImpl implements ContentService, ApplicationContextAwa
|
||||
}
|
||||
return validFor;
|
||||
}
|
||||
}
|
||||
}
|
@@ -25,7 +25,6 @@
|
||||
*/
|
||||
package org.alfresco.repo.content.caching;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;
|
||||
@@ -36,12 +35,12 @@ import org.alfresco.repo.content.caching.quota.QuotaManagerStrategy;
|
||||
import org.alfresco.repo.content.caching.quota.UnlimitedQuotaStrategy;
|
||||
import org.alfresco.repo.content.filestore.FileContentStore;
|
||||
import org.alfresco.repo.content.filestore.SpoofedTextContentReader;
|
||||
import org.alfresco.service.Experimental;
|
||||
import org.alfresco.service.cmr.repository.ContentIOException;
|
||||
import org.alfresco.service.cmr.repository.ContentReader;
|
||||
import org.alfresco.service.cmr.repository.ContentStreamListener;
|
||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||
import org.alfresco.service.cmr.repository.DirectAccessUrl;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.beans.factory.BeanNameAware;
|
||||
@@ -68,7 +67,7 @@ public class CachingContentStore implements ContentStore, ApplicationEventPublis
|
||||
private final static Log log = LogFactory.getLog(CachingContentStore.class);
|
||||
// NUM_LOCKS absolutely must be a power of 2 for the use of locks to be evenly balanced
|
||||
private final static int numLocks = 256;
|
||||
private final static ReentrantReadWriteLock[] locks;
|
||||
private final static ReentrantReadWriteLock[] locks;
|
||||
private ContentStore backingStore;
|
||||
private ContentCache cache;
|
||||
private QuotaManagerStrategy quota = new UnlimitedQuotaStrategy();
|
||||
@@ -382,13 +381,6 @@ public class CachingContentStore implements ContentStore, ApplicationEventPublis
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Experimental
|
||||
public Map<String, String> getStorageProperties(final String contentUrl)
|
||||
{
|
||||
return backingStore.getStorageProperties(contentUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a ReentrantReadWriteLock for a given URL. The lock is from a pool rather than
|
||||
* per URL, so some contention is expected.
|
||||
@@ -517,12 +509,4 @@ public class CachingContentStore implements ContentStore, ApplicationEventPublis
|
||||
{
|
||||
return backingStore.requestContentDirectUrl(contentUrl, attachment, fileName, validFor);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public DirectAccessUrl requestContentDirectUrl(String contentUrl, boolean attachment, String fileName, String mimeType, Long validFor)
|
||||
{
|
||||
return backingStore.requestContentDirectUrl(contentUrl, attachment, fileName, mimeType, validFor);
|
||||
}
|
||||
}
|
||||
|
@@ -25,10 +25,7 @@
|
||||
*/
|
||||
package org.alfresco.repo.content.replication;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReadWriteLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
@@ -39,11 +36,11 @@ import org.alfresco.repo.content.ContentContext;
|
||||
import org.alfresco.repo.content.ContentStore;
|
||||
import org.alfresco.repo.content.UnsupportedContentUrlException;
|
||||
import org.alfresco.repo.content.caching.CachingContentStore;
|
||||
import org.alfresco.service.Experimental;
|
||||
import org.alfresco.service.cmr.repository.ContentIOException;
|
||||
import org.alfresco.service.cmr.repository.ContentReader;
|
||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||
import org.alfresco.service.cmr.repository.DirectAccessUrl;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
@@ -67,10 +64,9 @@ import org.apache.commons.logging.LogFactory;
|
||||
* @see CachingContentStore
|
||||
*/
|
||||
public class AggregatingContentStore extends AbstractContentStore
|
||||
{
|
||||
{
|
||||
private static final Log logger = LogFactory.getLog(AggregatingContentStore.class);
|
||||
public static final String REPLICATING_CONTENT_STORE_NOT_INITIALISED = "ReplicatingContentStore not initialised";
|
||||
|
||||
|
||||
private ContentStore primaryStore;
|
||||
private List<ContentStore> secondaryStores;
|
||||
|
||||
@@ -138,7 +134,7 @@ public class AggregatingContentStore extends AbstractContentStore
|
||||
{
|
||||
if (primaryStore == null)
|
||||
{
|
||||
throw new AlfrescoRuntimeException(REPLICATING_CONTENT_STORE_NOT_INITIALISED);
|
||||
throw new AlfrescoRuntimeException("ReplicatingContentStore not initialised");
|
||||
}
|
||||
|
||||
// get a read lock so that we are sure that no replication is underway
|
||||
@@ -177,7 +173,7 @@ public class AggregatingContentStore extends AbstractContentStore
|
||||
{
|
||||
if (primaryStore == null)
|
||||
{
|
||||
throw new AlfrescoRuntimeException(REPLICATING_CONTENT_STORE_NOT_INITIALISED);
|
||||
throw new AlfrescoRuntimeException("ReplicatingContentStore not initialised");
|
||||
}
|
||||
|
||||
// get a read lock so that we are sure that no replication is underway
|
||||
@@ -247,7 +243,7 @@ public class AggregatingContentStore extends AbstractContentStore
|
||||
{
|
||||
// get the writer
|
||||
ContentWriter writer = primaryStore.getWriter(ctx);
|
||||
|
||||
|
||||
return writer;
|
||||
}
|
||||
|
||||
@@ -321,11 +317,11 @@ public class AggregatingContentStore extends AbstractContentStore
|
||||
return isContentDirectUrlEnabled;
|
||||
}
|
||||
|
||||
public DirectAccessUrl requestContentDirectUrl(String contentUrl, boolean attachment, String fileName, String mimetype, Long validFor)
|
||||
public DirectAccessUrl requestContentDirectUrl(String contentUrl, boolean attachment, String fileName, Long validFor)
|
||||
{
|
||||
if (primaryStore == null)
|
||||
{
|
||||
throw new AlfrescoRuntimeException(REPLICATING_CONTENT_STORE_NOT_INITIALISED);
|
||||
throw new AlfrescoRuntimeException("ReplicatingContentStore not initialised");
|
||||
}
|
||||
|
||||
// get a read lock so that we are sure that no replication is underway
|
||||
@@ -341,7 +337,7 @@ public class AggregatingContentStore extends AbstractContentStore
|
||||
// Check the primary store
|
||||
try
|
||||
{
|
||||
directAccessUrl = primaryStore.requestContentDirectUrl(contentUrl, attachment, fileName, mimetype, validFor);
|
||||
directAccessUrl = primaryStore.requestContentDirectUrl(contentUrl, attachment, fileName, validFor);
|
||||
}
|
||||
catch (UnsupportedOperationException e)
|
||||
{
|
||||
@@ -364,7 +360,7 @@ public class AggregatingContentStore extends AbstractContentStore
|
||||
{
|
||||
try
|
||||
{
|
||||
directAccessUrl = store.requestContentDirectUrl(contentUrl, attachment, fileName, mimetype, validFor);
|
||||
directAccessUrl = store.requestContentDirectUrl(contentUrl, attachment, fileName, validFor);
|
||||
}
|
||||
catch (UnsupportedOperationException e)
|
||||
{
|
||||
@@ -404,48 +400,4 @@ public class AggregatingContentStore extends AbstractContentStore
|
||||
readLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Experimental
|
||||
public Map<String, String> getStorageProperties(String contentUrl)
|
||||
{
|
||||
if (primaryStore == null) {
|
||||
throw new AlfrescoRuntimeException(REPLICATING_CONTENT_STORE_NOT_INITIALISED);
|
||||
}
|
||||
|
||||
// get a read lock so that we are sure that no replication is underway
|
||||
readLock.lock();
|
||||
try {
|
||||
Optional<Map<String, String>> objectStoragePropertiesMap = Optional.empty();
|
||||
// Check the primary store
|
||||
try {
|
||||
objectStoragePropertiesMap = Optional.of(primaryStore.getStorageProperties(contentUrl));
|
||||
} catch (UnsupportedContentUrlException e) {
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Primary store could not handle content URL: " + contentUrl);
|
||||
}
|
||||
}
|
||||
|
||||
if (objectStoragePropertiesMap.isEmpty()) {// the content is not in the primary store so we have to go looking for it
|
||||
for (ContentStore store : secondaryStores) {
|
||||
try {
|
||||
objectStoragePropertiesMap = Optional.of(store.getStorageProperties(contentUrl));
|
||||
} catch (UnsupportedContentUrlException e) {
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Secondary store " + store + " could not handle content URL: " + contentUrl);
|
||||
}
|
||||
}
|
||||
|
||||
if (objectStoragePropertiesMap.isPresent()) {
|
||||
return objectStoragePropertiesMap.get();
|
||||
}
|
||||
}
|
||||
throw new UnsupportedContentUrlException(this, contentUrl);
|
||||
}
|
||||
return objectStoragePropertiesMap.orElse(Collections.emptyMap());
|
||||
|
||||
} finally {
|
||||
readLock.unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -415,12 +415,13 @@ implements TenantDeployer, DictionaryListener, /*TenantDictionaryListener, */Mes
|
||||
|
||||
for (NodeRef messageResource : nodeRefs)
|
||||
{
|
||||
String resourceName = (String) nodeService.getProperty(messageResource, ContentModel.PROP_NAME);
|
||||
|
||||
String bundleBaseName = messageService.getBaseBundleName(resourceName);
|
||||
String messageResourcePath = nodeService.getPath(messageResource).toPrefixString(namespaceService);
|
||||
String bundleBasePrefixedName = messageResourcePath.substring(messageResourcePath.lastIndexOf("/"));
|
||||
String bundleBaseName = messageService.getBaseBundleName(bundleBasePrefixedName);
|
||||
|
||||
if (!resourceBundleBaseNames.contains(bundleBaseName))
|
||||
{
|
||||
messageService.registerResourceBundle(storeRef.toString() + repositoryLocation.getPath() + bundleBaseName);
|
||||
resourceBundleBaseNames.add(bundleBaseName);
|
||||
}
|
||||
}
|
||||
|
@@ -241,14 +241,9 @@ public class FixedAclUpdater extends TransactionListenerAdapter implements Appli
|
||||
@Override
|
||||
public int getTotalEstimatedWorkSize()
|
||||
{
|
||||
return (int)getTotalEstimatedWorkSizeLong();
|
||||
int workSize = getNodesWithAspects.getWorkSize();
|
||||
return workSize;
|
||||
}
|
||||
@Override
|
||||
public long getTotalEstimatedWorkSizeLong()
|
||||
{
|
||||
return getNodesWithAspects.getWorkSize();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Collection<NodeRef> getNextWork()
|
||||
|
@@ -244,15 +244,6 @@ public class NodeArchiveServiceImpl implements NodeArchiveService
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns 0, always
|
||||
*/
|
||||
public synchronized long getTotalEstimatedWorkSizeLong()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public synchronized Collection<NodeRef> getNextWork()
|
||||
{
|
||||
if (vmShutdownLister.isVmShuttingDown())
|
||||
|
@@ -1,28 +1,28 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* 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
|
||||
* 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%
|
||||
*/
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* 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
|
||||
* 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.node.db;
|
||||
|
||||
import java.util.Collection;
|
||||
@@ -240,12 +240,6 @@ public class NodeStringLengthWorker implements ApplicationContextAware
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getTotalEstimatedWorkSizeLong()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<NodePropertyEntity> getNextWork()
|
||||
{
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* 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
|
||||
@@ -683,6 +683,7 @@ 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 - 2020 Alfresco Software Limited
|
||||
* 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
|
||||
@@ -538,9 +538,8 @@ public class RenditionService2Impl implements RenditionService2, InitializingBea
|
||||
}
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Set rendition hashcode " + transformContentHashCode + " and ThumbnailLastModified for " + renditionName);
|
||||
logger.debug("Set ThumbnailLastModified for " + renditionName);
|
||||
}
|
||||
nodeService.setProperty(renditionNode, RenditionModel.PROP_RENDITION_CONTENT_HASH_CODE, transformContentHashCode);
|
||||
setThumbnailLastModified(sourceNodeRef, renditionName);
|
||||
|
||||
if (transformInputStream != null)
|
||||
@@ -554,6 +553,11 @@ 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)
|
||||
{
|
||||
@@ -563,16 +567,7 @@ public class RenditionService2Impl implements RenditionService2, InitializingBea
|
||||
}
|
||||
else
|
||||
{
|
||||
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");
|
||||
}
|
||||
}
|
||||
clearRenditionContentData(renditionNode);
|
||||
}
|
||||
|
||||
if (!sourceHasAspectRenditioned)
|
||||
@@ -736,6 +731,43 @@ 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.
|
||||
@@ -886,6 +918,7 @@ public class RenditionService2Impl implements RenditionService2, InitializingBea
|
||||
RenditionDefinition2 renditionDefinition = renditionDefinitionRegistry2.getRenditionDefinition(renditionName);
|
||||
if (renditionDefinition != null)
|
||||
{
|
||||
clearRenditionContentData(sourceNodeRef, renditionName);
|
||||
render(sourceNodeRef, renditionName);
|
||||
}
|
||||
else
|
||||
|
@@ -1,28 +1,28 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* 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
|
||||
* 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%
|
||||
*/
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* 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
|
||||
* 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.security.authentication;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -403,15 +403,6 @@ public class UpgradePasswordHashWorker implements ApplicationContextAware, Initi
|
||||
return (int)totalUserCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getTotalEstimatedWorkSizeLong()
|
||||
{
|
||||
// execute a query to get total number of user nodes in the system.
|
||||
long totalUserCount = patchDAO.getCountNodesWithTypId(ContentModel.TYPE_USER);
|
||||
|
||||
return totalUserCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Long> getNextWork()
|
||||
{
|
||||
|
@@ -1,28 +1,28 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* 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
|
||||
* 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%
|
||||
*/
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* 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
|
||||
* 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.security.person;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -320,8 +320,8 @@ public class HomeFolderProviderSynchronizer extends AbstractLifecycleBean
|
||||
threadCount, peoplePerTransaction,
|
||||
null,
|
||||
batchLogger, 100);
|
||||
processor.processLong(worker, true);
|
||||
if (processor.getTotalErrorsLong() > 0)
|
||||
processor.process(worker, true);
|
||||
if (processor.getTotalErrors() > 0)
|
||||
{
|
||||
logger.info(" -- Give up after error --");
|
||||
break;
|
||||
@@ -874,12 +874,6 @@ public class HomeFolderProviderSynchronizer extends AbstractLifecycleBean
|
||||
return size;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized long getTotalEstimatedWorkSizeLong()
|
||||
{
|
||||
return size;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized Collection<NodeRef> getNextWork()
|
||||
{
|
||||
|
@@ -1,52 +1,51 @@
|
||||
/*
|
||||
* #%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%
|
||||
*/
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* 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
|
||||
* 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.tenant;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;
|
||||
|
||||
import org.alfresco.repo.content.AbstractRoutingContentStore;
|
||||
import org.alfresco.repo.content.ContentContext;
|
||||
import org.alfresco.repo.content.ContentStore;
|
||||
import org.alfresco.repo.domain.tenant.TenantAdminDAO;
|
||||
import org.alfresco.repo.domain.tenant.TenantEntity;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.tenant.TenantUtil.TenantRunAsWork;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.Experimental;
|
||||
import org.alfresco.service.transaction.TransactionService;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;
|
||||
|
||||
import org.alfresco.repo.content.AbstractRoutingContentStore;
|
||||
import org.alfresco.repo.content.ContentContext;
|
||||
import org.alfresco.repo.content.ContentStore;
|
||||
import org.alfresco.repo.domain.tenant.TenantAdminDAO;
|
||||
import org.alfresco.repo.domain.tenant.TenantEntity;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.tenant.TenantUtil.TenantRunAsWork;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.transaction.TransactionService;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
|
||||
/**
|
||||
* Content Store that supports tenant routing, if multi-tenancy is enabled.
|
||||
@@ -271,13 +270,6 @@ public abstract class AbstractTenantRoutingContentStore extends AbstractRoutingC
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@Experimental
|
||||
@Override
|
||||
public Map<String, String> getStorageProperties(String contentUrl)
|
||||
{
|
||||
return getTenantContentStore().getStorageProperties(contentUrl);
|
||||
}
|
||||
|
||||
|
||||
protected abstract ContentStore initContentStore(ApplicationContext ctx, String contentRoot);
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2017 Alfresco Software Limited
|
||||
* 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
|
||||
@@ -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.getSize() == 0)
|
||||
if (content == null || content.getSize() == 0)
|
||||
{
|
||||
TransactionalResourceHelper.getSet(THUMBNAIL_TO_DELETE_NODES).add(thumbnailNode);
|
||||
TransactionSupportUtil.bindListener(this.thumbnailsToDeleteTransactionListener, 0);
|
||||
|
@@ -28,13 +28,9 @@ package org.alfresco.service.cmr.repository;
|
||||
|
||||
import org.alfresco.api.AlfrescoPublicApi;
|
||||
import org.alfresco.service.Auditable;
|
||||
import org.alfresco.service.Experimental;
|
||||
import org.alfresco.service.cmr.dictionary.InvalidTypeException;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Provides methods for accessing and transforming content.
|
||||
* <p>
|
||||
@@ -198,22 +194,4 @@ public interface ContentService
|
||||
*/
|
||||
@Auditable(parameters = {"nodeRef", "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.
|
||||
* A particular Cloud Connector will fill in that data with Cloud Storage Provider generic data.
|
||||
* Map may be also filled in with entries consisting of pre-defined Alfresco keys of {@code ObjectStorageProps} and their values.
|
||||
* If empty Map is returned - no connector is present or connector is not supporting retrieval of the properties
|
||||
* or cannot determine the properties.
|
||||
*
|
||||
* @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 Returns a key-value (String-String) collection of storage headers/properties with their respective values for a given {@link NodeRef}.
|
||||
*/
|
||||
@Auditable
|
||||
@Experimental
|
||||
default Map<String, String> getStorageProperties(NodeRef nodeRef, QName propertyQName)
|
||||
{
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
}
|
||||
|
@@ -1,28 +1,28 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* 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
|
||||
* 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%
|
||||
*/
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* 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
|
||||
* 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.tools;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
@@ -59,13 +59,13 @@ import org.alfresco.service.transaction.TransactionService;
|
||||
import org.alfresco.util.VmShutdownListener;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* Rename user tool. This tool provides minimal support for renaming users.
|
||||
* See {@link #displayHelp} message for restrictions.
|
||||
* <pre>
|
||||
* Usage: renameUser -user username [options] oldUsername newUsername");
|
||||
* renameUser -user username [options] -file filename");
|
||||
|
||||
/**
|
||||
* Rename user tool. This tool provides minimal support for renaming users.
|
||||
* See {@link #displayHelp} message for restrictions.
|
||||
* <pre>
|
||||
* Usage: renameUser -user username [options] oldUsername newUsername");
|
||||
* renameUser -user username [options] -file filename");
|
||||
* </pre>
|
||||
* The csv file has a simple comma separated list, with
|
||||
* a pair of usernames on each line. Comments and blank
|
||||
@@ -549,12 +549,6 @@ public class RenameUser extends Tool
|
||||
return size;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized long getTotalEstimatedWorkSizeLong()
|
||||
{
|
||||
return size;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized Collection<User> getNextWork()
|
||||
{
|
||||
|
@@ -27,7 +27,7 @@
|
||||
<!-- that inherit from that type. Permissions defined against aspects apply to all -->
|
||||
<!-- objects or only objects that have the aspect applied. For example, the permission -->
|
||||
<!-- to lock an object could apply to any object but the permission to unlock an -->
|
||||
<!-- object would only apply to objects that have the lockable aspect. -->
|
||||
<!-- object woujld only apply to objects that have the lockable aspect. -->
|
||||
<!-- -->
|
||||
|
||||
<!-- =============================================== -->
|
||||
@@ -42,7 +42,7 @@
|
||||
|
||||
<!-- -->
|
||||
<!-- Permission groups are convenient groups of permissions. They may be used in -->
|
||||
<!-- their own right or as the effective set of permissions. If an authority has -->
|
||||
<!-- thier own right or as the effective set of permissions. If an authority has -->
|
||||
<!-- all the permissions that make up a permission group they also have that -->
|
||||
<!-- permission group even though it has not been explicitly granted. -->
|
||||
<!-- -->
|
||||
@@ -153,7 +153,7 @@
|
||||
<!-- The permission to delete a node -->
|
||||
<!-- -->
|
||||
<!-- A node can only be deleted if there is delete permission on the node, if the -->
|
||||
<!-- node is accessible via its parent, and if the node can be deleted from its -->
|
||||
<!-- node is accesible via its parent, and if the node can be deleted from its -->
|
||||
<!-- parent. Currently, there is no check that all the children can be deleted. -->
|
||||
<!-- This check can be added but requires more work so the UI is not checking this -->
|
||||
<!-- permission just to show the delete icon. -->
|
||||
@@ -229,7 +229,7 @@
|
||||
-->
|
||||
</permission>
|
||||
|
||||
<!-- The permission to delete associations between nodes (not children) -->
|
||||
<!-- The permission to delte associations between nodes (not children) -->
|
||||
|
||||
<permission name="_DeleteAssociations" expose="false" >
|
||||
<grantedToGroup permissionGroup="DeleteAssociations" />
|
||||
@@ -456,7 +456,7 @@
|
||||
<!-- They can not be denied by the permissions set on any node. -->
|
||||
<!-- -->
|
||||
|
||||
<!-- Admin can do anything to any node -->
|
||||
<!-- Admin can do anything to any ndoe -->
|
||||
<globalPermission permission="FullControl" authority="ROLE_ADMINISTRATOR"/>
|
||||
|
||||
<!-- For now, owners can always see, find and manipulate their stuff -->
|
||||
@@ -468,7 +468,7 @@
|
||||
<!-- Check in is granted to the lock owner -->
|
||||
<globalPermission permission="CheckIn" authority="ROLE_LOCK_OWNER"/>
|
||||
|
||||
<!-- Cancel check out is granted to the lock owner -->
|
||||
<!-- Cancel check out is granted to the locak owner -->
|
||||
<globalPermission permission="CancelCheckOut" authority="ROLE_LOCK_OWNER"/>
|
||||
|
||||
</permissions>
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user