Compare commits

...

67 Commits

Author SHA1 Message Date
rrajoria
2526218bdb create Reset Password Test Case 2023-03-22 12:18:20 +05:30
rrajoria
4d717e0d89 create Reset Password Test Case 2023-03-22 12:16:06 +05:30
rrajoria
dbc6407f66 create Reset Password Test Case 2023-03-22 11:45:00 +05:30
rrajoria
401614db8a create Reset Password Test Case 2023-03-21 20:15:35 +05:30
rrajoria
79fe89c7f1 create Reset Password Test Case 2023-03-21 19:19:12 +05:30
rrajoria
a60547a4f0 create Reset Password Test Case 2023-03-21 18:55:44 +05:30
rrajoria
0517eb6605 create Reset Password Test Case 2023-03-21 18:53:26 +05:30
rrajoria
eae11c4de3 create Reset Password Test Case 2023-03-21 18:09:16 +05:30
rrajoria
6885b817e1 create Reset Password Test Case 2023-03-21 18:07:22 +05:30
Mohinish Sah
91f3edf8e9 incorporated review comments 2023-03-02 22:10:54 +05:30
Mohinish Sah
479724365e incorporated review comments 2023-03-02 22:04:50 +05:30
Mohinish Sah
bb1d5899d9 Merge remote-tracking branch 'origin/master' into feature/ACA-4619-Self-service-User-password-reset-ADW 2023-03-02 21:46:53 +05:30
Mohinish Sah
7ab5e8afd0 Updated the client App name 2023-03-01 18:45:08 +05:30
Mohinish Sah
5107fdfe41 resolved review comments 2023-03-01 12:45:15 +05:30
Alfresco CI User
9ab2ec65df [force] Force release for 2023-01-01. 2023-01-01 00:03:31 +00:00
Travis CI User
0f20b08ca2 [maven-release-plugin][skip ci] prepare for next development iteration 2022-12-25 00:09:40 +00:00
Travis CI User
41530a1d34 [maven-release-plugin][skip ci] prepare release 20.49 2022-12-25 00:09:37 +00:00
Alfresco CI User
7616468c54 [force] Force release for 2022-12-25. 2022-12-25 00:03:09 +00:00
Travis CI User
ab101c8698 [maven-release-plugin][skip ci] prepare for next development iteration 2022-12-22 12:35:34 +00:00
Travis CI User
31c9a92fd6 [maven-release-plugin][skip ci] prepare release 20.48 2022-12-22 12:35:31 +00:00
Antonio Felix
d785b100df Fix/mnt 23290 slow group membership (#1637)
* MNT-23290 - Change query to get the root groups
2022-12-22 11:48:55 +00:00
Travis CI User
3b25edefd1 [maven-release-plugin][skip ci] prepare for next development iteration 2022-12-20 09:25:30 +00:00
Travis CI User
7e660572d6 [maven-release-plugin][skip ci] prepare release 20.47 2022-12-20 09:25:27 +00:00
Domenico Sibilio
2a2ae2448e ACS-4188 Migrate tas tests to Log4j 2.x (#1630)
* ACS-4188 Migrate tas tests to Log4j 2.x

* ACS-4188 Make main log4j2.properties file more compact

* ACS-4188 Remove unnecessary log4j2 test dependencies

* ACS-4188 Rename log4j.properties file
2022-12-20 09:45:10 +01:00
Travis CI User
c40b862012 [maven-release-plugin][skip ci] prepare for next development iteration 2022-12-18 00:13:41 +00:00
Travis CI User
c4fe682c81 [maven-release-plugin][skip ci] prepare release 20.46 2022-12-18 00:13:39 +00:00
Alfresco CI User
12af8f5766 [force] Force release for 2022-12-18. 2022-12-18 00:05:58 +00:00
Travis CI User
ea400226ba [maven-release-plugin][skip ci] prepare for next development iteration 2022-12-16 12:10:33 +00:00
Travis CI User
8c21806cf4 [maven-release-plugin][skip ci] prepare release 20.45 2022-12-16 12:10:31 +00:00
krdabrowski
cea3e37dd5 ACS-4029: Update a category name - PUT /categories/{categoryId} (#1621)
* ACS-4029: Update a category name - PUT /categories/{categoryId}
2022-12-16 12:36:06 +01:00
Travis CI User
60a04b0402 [maven-release-plugin][skip ci] prepare for next development iteration 2022-12-16 11:03:04 +00:00
Travis CI User
c50c10ef2b [maven-release-plugin][skip ci] prepare release 20.44 2022-12-16 11:03:01 +00:00
Damian Ujma
cdbe3292e0 ACS-3841 Add missing logs for WebDAV TAS tests (#1629)
* ACS-3841 Add missing logs

* ACS-3841 Reformat code + fix grep
2022-12-16 11:27:02 +01:00
Travis CI User
54843fa336 [maven-release-plugin][skip ci] prepare for next development iteration 2022-12-15 14:09:45 +00:00
Travis CI User
c66bb48258 [maven-release-plugin][skip ci] prepare release 20.43 2022-12-15 14:09:41 +00:00
kcichonczyk
077752ad86 bumped IE version to 2.0.6 (ACS-4054) (#1628) 2022-12-15 14:28:46 +01:00
Travis CI User
1749b2d74b [maven-release-plugin][skip ci] prepare for next development iteration 2022-12-14 16:39:51 +00:00
Travis CI User
eea23b0d2a [maven-release-plugin][skip ci] prepare release 20.42 2022-12-14 16:39:48 +00:00
George Evangelopoulos
88b6a8e5b3 ACS-4030: Delete category endpoint (#1618)
* ACS-4030: Delete category endpoint implementation and tests
2022-12-14 16:00:59 +00:00
Travis CI User
28114338c8 [maven-release-plugin][skip ci] prepare for next development iteration 2022-12-13 16:59:55 +00:00
Travis CI User
78e1d5863c [maven-release-plugin][skip ci] prepare release 20.41 2022-12-13 16:59:52 +00:00
Maciej Pichura
0aae95b255 ACS-4031 list category children (#1617)
* ACS-4031: Get category children endpoint.

* ACS-4031: Fix in E2E test.

* ACS-4031: Adding more unit tests.

* Fix test description

Co-authored-by: Tom Page <tpage-alfresco@users.noreply.github.com>

* Fix test description

Co-authored-by: Tom Page <tpage-alfresco@users.noreply.github.com>

* ACS-4031: Refactoring after code review.

* ACS-4031: Updating E2E test after latest logic refactor.

Co-authored-by: Tom Page <tpage-alfresco@users.noreply.github.com>
2022-12-13 17:13:02 +01:00
Travis CI User
c1198a0145 [maven-release-plugin][skip ci] prepare for next development iteration 2022-12-11 00:10:54 +00:00
Travis CI User
6bd50fda1a [maven-release-plugin][skip ci] prepare release 20.40 2022-12-11 00:10:52 +00:00
Alfresco CI User
ace6eca99b [force] Force release for 2022-12-11. 2022-12-11 00:03:34 +00:00
Travis CI User
0f8349dc4c [maven-release-plugin][skip ci] prepare for next development iteration 2022-12-09 10:34:04 +00:00
Travis CI User
eb7bcbfbfb [maven-release-plugin][skip ci] prepare release 20.39 2022-12-09 10:34:02 +00:00
dependabot[bot]
d9bbc9c628 Bump alfresco-googledrive-repo-community (#1611)
Bumps [alfresco-googledrive-repo-community](https://github.com/Alfresco/googledrive) from 3.3.1-DEV-LOG4J2 to 3.4.0-A1.
- [Release notes](https://github.com/Alfresco/googledrive/releases)
- [Changelog](https://github.com/Alfresco/googledrive/blob/master/docs/build-and-release-101.md)
- [Commits](https://github.com/Alfresco/googledrive/compare/3.3.1-DEV-LOG4J2...3.4.0-A1)

---
updated-dependencies:
- dependency-name: org.alfresco.integrations:alfresco-googledrive-repo-community
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-09 10:53:15 +01:00
Travis CI User
5c434f7898 [maven-release-plugin][skip ci] prepare for next development iteration 2022-12-08 17:19:04 +00:00
Travis CI User
06a25a48da [maven-release-plugin][skip ci] prepare release 20.38 2022-12-08 17:19:01 +00:00
Maciej Pichura
f511436823 ACS-4032 create category (multiple categories pagination fix) (#1610)
* ACS-4032: Some fixes and refactors after verification. Fixing pagination info on POST multiple entities response.

* ACS-4032: Some fixes and refactors after verification. Fixing pagination info on POST multiple entities response.

* Fixing a test STEP description

Co-authored-by: Tom Page <tpage-alfresco@users.noreply.github.com>

Co-authored-by: Tom Page <tpage-alfresco@users.noreply.github.com>
2022-12-08 17:40:56 +01:00
Mohinish Sah
f59ff23a45 Rebase Branch 2022-12-08 16:26:44 +05:30
rrajoria
5e2f1db714 ACA-4619: Forgot Password Changes 2022-12-08 16:21:29 +05:30
rrajoria
67ee2efc60 ACA-4619: Forgot Password Changes 2022-12-08 16:21:29 +05:30
Travis CI User
f96b3012c4 [maven-release-plugin][skip ci] prepare for next development iteration 2022-12-08 10:17:34 +00:00
Travis CI User
415aa2ca33 [maven-release-plugin][skip ci] prepare release 20.37 2022-12-08 10:17:31 +00:00
Maciej Pichura
b701f9a994 ACS-4032 Create category (POST) (#1606)
* ACS-4028 Get category by id (#1591)

* ACS-4028: Get category by id endpoint.

* ACS-4028: Get category by id endpoint.

* ACS-4028: Get category by id endpoint - integration TAS tests.

* ACS-4028: Get category by id endpoint - refactoring.

* ACS-4028: Adding test to test suite.

* ACS-4028: Fixes after code review.

* ACS-4032: Initial code for POST category endpoint.

* ACS-4032: Full implementation for POST category endpoint + tests.

* ACS-4032: Some fixes and refactors after code review.
2022-12-08 10:43:22 +01:00
Travis CI User
d04043b015 [maven-release-plugin][skip ci] prepare for next development iteration 2022-12-08 08:59:35 +00:00
Travis CI User
e3241fe178 [maven-release-plugin][skip ci] prepare release 20.36 2022-12-08 08:59:32 +00:00
Damian Ujma
ea8ed0eec3 ACS-4142 Update AOS version (#1607) 2022-12-08 09:20:03 +01:00
Travis CI User
31d5b0985f [maven-release-plugin][skip ci] prepare for next development iteration 2022-12-07 10:07:23 +00:00
Travis CI User
15ebb627ce [maven-release-plugin][skip ci] prepare release 20.35 2022-12-07 10:07:20 +00:00
Maciej Pichura
90ca0dea6c ACS-4028 GET Category by id (#1601)
* ACS-4028 Get category by id (#1591)

* ACS-4028: Get category by id endpoint.

* ACS-4028: Get category by id endpoint.

* ACS-4028: Get category by id endpoint - integration TAS tests.

* ACS-4028: Get category by id endpoint - refactoring.

* ACS-4028: Adding test to test suite.

* ACS-4028: Fixes after code review.

* ACS-4019: Removing redundant test group.
2022-12-07 10:32:08 +01:00
Travis CI User
e48315e4b5 [maven-release-plugin][skip ci] prepare for next development iteration 2022-12-06 15:11:11 +00:00
MohinishSah
1e7dc6ed8d update Gdrive version 2022-11-14 10:54:40 +05:30
rrajoria
e5ea6db30c ACA-4619: Forgot Password Changes 2022-11-09 18:11:16 +05:30
rrajoria
78a613b1de ACA-4619: Forgot Password Changes 2022-11-09 18:10:29 +05:30
94 changed files with 4475 additions and 780 deletions

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-amps</artifactId>
<version>20.34</version>
<version>20.50-SNAPSHOT</version>
</parent>
<modules>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-governance-services-community-parent</artifactId>
<version>20.34</version>
<version>20.50-SNAPSHOT</version>
</parent>
<modules>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-governance-services-automation-community-repo</artifactId>
<version>20.34</version>
<version>20.50-SNAPSHOT</version>
</parent>
<build>
@@ -42,18 +42,6 @@
</build>
<dependencies>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j2-impl</artifactId>
<version>${dependency.log4j.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${dependency.log4j.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.alfresco.tas</groupId>
<artifactId>restapi</artifactId>
@@ -69,17 +57,6 @@
<groupId>org.alfresco.tas</groupId>
<artifactId>utility</artifactId>
<version>${dependency.tas-utility.version}</version>
<!-- These exclusions can be removed once tas-utility does not rely on Reload4j anymore -->
<exclusions>
<exclusion>
<groupId>ch.qos.reload4j</groupId>
<artifactId>reload4j</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-reload4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-governance-services-community-parent</artifactId>
<version>20.34</version>
<version>20.50-SNAPSHOT</version>
</parent>
<modules>

View File

@@ -1,3 +1,3 @@
SOLR6_TAG=2.0.6-A4
SOLR6_TAG=2.0.6
POSTGRES_TAG=14.4
ACTIVEMQ_TAG=5.17.1-jre11-rockylinux8

View File

@@ -47,6 +47,7 @@ rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getPaths=RM.Re
rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getStoreArchiveNode=RM_ABSTAIN
rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.restoreNode=RM_ABSTAIN
rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getChildAssocsWithoutParentAssocsOfType=RM_ABSTAIN
rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.findAssocsNotLinkedByTwoOtherAssocs=RM_ABSTAIN
rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getNodeRef=RM.Read.0
rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getChildAssocsByPropertyValue=RM.Read.0,AFTER_RM.FilterNode
rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.countChildAssocs=RM.Read.0

View File

@@ -8,7 +8,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-governance-services-community-repo-parent</artifactId>
<version>20.34</version>
<version>20.50-SNAPSHOT</version>
</parent>
<properties>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-governance-services-community-repo-parent</artifactId>
<version>20.34</version>
<version>20.50-SNAPSHOT</version>
</parent>
<build>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo</artifactId>
<version>20.34</version>
<version>20.50-SNAPSHOT</version>
</parent>
<modules>

View File

@@ -8,7 +8,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-amps</artifactId>
<version>20.34</version>
<version>20.50-SNAPSHOT</version>
</parent>
<properties>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo</artifactId>
<version>20.34</version>
<version>20.50-SNAPSHOT</version>
</parent>
<dependencies>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo</artifactId>
<version>20.34</version>
<version>20.50-SNAPSHOT</version>
</parent>
<properties>

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Data model classes
* %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
@@ -714,6 +714,18 @@ public interface NodeService
final NodeRef parent,
final QName assocTypeQName);
/**
* Gets the list of the localnames of the child associations without parent node
*
* @param parent
* the parent node reference
* @return a list of the local names of the child associations
*/
@Auditable(parameters = {"parent"})
public List<String> findAssocsNotLinkedByTwoOtherAssocs(
final NodeRef parent);
/**
* Create a peer association between two nodes.
* <p/>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo</artifactId>
<version>20.34</version>
<version>20.50-SNAPSHOT</version>
</parent>
<dependencies>

View File

@@ -9,6 +9,6 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-packaging</artifactId>
<version>20.34</version>
<version>20.50-SNAPSHOT</version>
</parent>
</project>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-packaging</artifactId>
<version>20.34</version>
<version>20.50-SNAPSHOT</version>
</parent>
<properties>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo</artifactId>
<version>20.34</version>
<version>20.50-SNAPSHOT</version>
</parent>
<modules>

View File

@@ -1,3 +1,3 @@
SOLR6_TAG=2.0.6-A4
SOLR6_TAG=2.0.6
POSTGRES_TAG=14.4
ACTIVEMQ_TAG=5.17.1-jre11-rockylinux8

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-packaging</artifactId>
<version>20.34</version>
<version>20.50-SNAPSHOT</version>
</parent>
<modules>

View File

@@ -4,4 +4,4 @@ TAS_DIRECTORY=$1
cd ${TAS_DIRECTORY}
cat target/reports/alfresco-tas.log | grep "*** STARTING"
cat target/reports/alfresco-tas.log | grep -a "*** STARTING"

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-tests</artifactId>
<version>20.34</version>
<version>20.50-SNAPSHOT</version>
</parent>
<organization>

View File

@@ -1,26 +0,0 @@
# Root logger option
log4j.rootLogger=INFO, file, stdout
# Direct log messages to a log file
log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.File=./target/reports/alfresco-tas.log
log4j.appender.file.MaxBackupIndex=10
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=[%t] %d{HH:mm:ss} %-5p %c{1}:%L - %m%n
# Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[%t] %d{HH:mm:ss} %-5p %c{1}:%L - %m%n
# TestRail particular log file
# Direct log messages to a log file
log4j.appender.testrailLog=org.apache.log4j.RollingFileAppender
log4j.appender.testrailLog.File=./target/reports/alfresco-testrail.log
log4j.appender.testrailLog.MaxBackupIndex=10
log4j.appender.testrailLog.layout=org.apache.log4j.PatternLayout
log4j.appender.testrailLog.layout.ConversionPattern=%d{HH:mm:ss} %-5p %c{1}:%L - %m%n
log4j.category.testrail=INFO, testrailLog
log4j.additivity.testrail=false

View File

@@ -0,0 +1,42 @@
# Root logger option
rootLogger.level=info
rootLogger.appenderRef.stdout.ref=ConsoleAppender
rootLogger.appenderRef.rolling.ref=RollingAppender
###### File appender definition #######
appender.rolling.type=RollingFile
appender.rolling.name=RollingAppender
appender.rolling.fileName=./target/reports/alfresco-tas.log
appender.rolling.filePattern=./target/reports/alfresco-tas.log.%i
appender.rolling.layout.type=PatternLayout
appender.rolling.layout.pattern=[%t] %d{HH:mm:ss} %-5p %c{1}:%L - %replace{%m}{[\r\n]+}{}%n
appender.rolling.policies.type = Policies
appender.rolling.policies.size.type=SizeBasedTriggeringPolicy
appender.rolling.policies.size.size=10MB
appender.rolling.strategy.type=DefaultRolloverStrategy
appender.rolling.strategy.max=10
###### Console appender definition #######
appender.console.type=Console
appender.console.name=ConsoleAppender
appender.console.layout.type=PatternLayout
appender.console.layout.pattern=[%t] %d{HH:mm:ss} %-5p %c{1}:%L - %replace{%m}{[\r\n]+}{}%n
# TestRail particular log file
# Direct log messages to a log file
logger.testrail.name=testrail
logger.testrail.level=info
logger.testrail.additivity=false
logger.testrail.appenderRef.testrail.ref=TestrailAppender
appender.testrail.name=TestrailAppender
appender.testrail.type=RollingFile
appender.testrail.fileName=./target/reports/alfresco-testrail.log
appender.testrail.filePattern=./target/reports/alfresco-testrail.log.%i
appender.testrail.layout.type=PatternLayout
appender.testrail.layout.pattern=%d{HH:mm:ss} %-5p %c{1}:%L - %replace{%m}{[\r\n]+}{}%n
appender.testrail.policies.type=Policies
appender.testrail.policies.size.type=SizeBasedTriggeringPolicy
appender.testrail.policies.size.size=10MB
appender.testrail.strategy.type=DefaultRolloverStrategy
appender.testrail.strategy.max=10

View File

@@ -1,26 +0,0 @@
# Root logger option
log4j.rootLogger=INFO, file, stdout
# Direct log messages to a log file
log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.File=./target/reports/alfresco-tas.log
log4j.appender.file.MaxBackupIndex=10
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=[%t] %d{HH:mm:ss} %-5p %c{1}:%L - %m%n
# Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[%t] %d{HH:mm:ss} %-5p %c{1}:%L - %m%n
# TestRail particular log file
# Direct log messages to a log file
log4j.appender.testrailLog=org.apache.log4j.RollingFileAppender
log4j.appender.testrailLog.File=./target/reports/alfresco-testrail.log
log4j.appender.testrailLog.MaxBackupIndex=10
log4j.appender.testrailLog.layout=org.apache.log4j.PatternLayout
log4j.appender.testrailLog.layout.ConversionPattern=%d{HH:mm:ss} %-5p %c{1}:%L - %m%n
log4j.category.testrail=INFO, testrailLog
log4j.additivity.testrail=false

View File

@@ -0,0 +1,42 @@
# Root logger option
rootLogger.level=info
rootLogger.appenderRef.stdout.ref=ConsoleAppender
rootLogger.appenderRef.rolling.ref=RollingAppender
###### File appender definition #######
appender.rolling.type=RollingFile
appender.rolling.name=RollingAppender
appender.rolling.fileName=./target/reports/alfresco-tas.log
appender.rolling.filePattern=./target/reports/alfresco-tas.log.%i
appender.rolling.layout.type=PatternLayout
appender.rolling.layout.pattern=[%t] %d{HH:mm:ss} %-5p %c{1}:%L - %replace{%m}{[\r\n]+}{}%n
appender.rolling.policies.type = Policies
appender.rolling.policies.size.type=SizeBasedTriggeringPolicy
appender.rolling.policies.size.size=10MB
appender.rolling.strategy.type=DefaultRolloverStrategy
appender.rolling.strategy.max=10
###### Console appender definition #######
appender.console.type=Console
appender.console.name=ConsoleAppender
appender.console.layout.type=PatternLayout
appender.console.layout.pattern=[%t] %d{HH:mm:ss} %-5p %c{1}:%L - %replace{%m}{[\r\n]+}{}%n
# TestRail particular log file
# Direct log messages to a log file
logger.testrail.name=testrail
logger.testrail.level=info
logger.testrail.additivity=false
logger.testrail.appenderRef.testrail.ref=TestrailAppender
appender.testrail.name=TestrailAppender
appender.testrail.type=RollingFile
appender.testrail.fileName=./target/reports/alfresco-testrail.log
appender.testrail.filePattern=./target/reports/alfresco-testrail.log.%i
appender.testrail.layout.type=PatternLayout
appender.testrail.layout.pattern=%d{HH:mm:ss} %-5p %c{1}:%L - %replace{%m}{[\r\n]+}{}%n
appender.testrail.policies.type=Policies
appender.testrail.policies.size.type=SizeBasedTriggeringPolicy
appender.testrail.policies.size.size=10MB
appender.testrail.strategy.type=DefaultRolloverStrategy
appender.testrail.strategy.max=10

View File

@@ -9,7 +9,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-tests</artifactId>
<version>20.34</version>
<version>20.50-SNAPSHOT</version>
</parent>
<developers>

View File

@@ -1,26 +0,0 @@
# Root logger option
log4j.rootLogger=INFO, file, stdout
# Direct log messages to a log file
log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.File=./target/reports/alfresco-tas.log
log4j.appender.file.MaxBackupIndex=10
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=[%t] %d{HH:mm:ss} %-5p %c{1}:%L - %m%n
# Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[%t] %d{HH:mm:ss} %-5p %c{1}:%L - %m%n
# TestRail particular log file
# Direct log messages to a log file
log4j.appender.testrailLog=org.apache.log4j.RollingFileAppender
log4j.appender.testrailLog.File=./target/reports/alfresco-testrail.log
log4j.appender.testrailLog.MaxBackupIndex=10
log4j.appender.testrailLog.layout=org.apache.log4j.PatternLayout
log4j.appender.testrailLog.layout.ConversionPattern=%d{HH:mm:ss} %-5p %c{1}:%L - %m%n
log4j.category.testrail=INFO, testrailLog
log4j.additivity.testrail=false

View File

@@ -0,0 +1,42 @@
# Root logger option
rootLogger.level=info
rootLogger.appenderRef.stdout.ref=ConsoleAppender
rootLogger.appenderRef.rolling.ref=RollingAppender
###### File appender definition #######
appender.rolling.type=RollingFile
appender.rolling.name=RollingAppender
appender.rolling.fileName=./target/reports/alfresco-tas.log
appender.rolling.filePattern=./target/reports/alfresco-tas.log.%i
appender.rolling.layout.type=PatternLayout
appender.rolling.layout.pattern=[%t] %d{HH:mm:ss} %-5p %c{1}:%L - %replace{%m}{[\r\n]+}{}%n
appender.rolling.policies.type = Policies
appender.rolling.policies.size.type=SizeBasedTriggeringPolicy
appender.rolling.policies.size.size=10MB
appender.rolling.strategy.type=DefaultRolloverStrategy
appender.rolling.strategy.max=10
###### Console appender definition #######
appender.console.type=Console
appender.console.name=ConsoleAppender
appender.console.layout.type=PatternLayout
appender.console.layout.pattern=[%t] %d{HH:mm:ss} %-5p %c{1}:%L - %replace{%m}{[\r\n]+}{}%n
# TestRail particular log file
# Direct log messages to a log file
logger.testrail.name=testrail
logger.testrail.level=info
logger.testrail.additivity=false
logger.testrail.appenderRef.testrail.ref=TestrailAppender
appender.testrail.name=TestrailAppender
appender.testrail.type=RollingFile
appender.testrail.fileName=./target/reports/alfresco-testrail.log
appender.testrail.filePattern=./target/reports/alfresco-testrail.log.%i
appender.testrail.layout.type=PatternLayout
appender.testrail.layout.pattern=%d{HH:mm:ss} %-5p %c{1}:%L - %replace{%m}{[\r\n]+}{}%n
appender.testrail.policies.type=Policies
appender.testrail.policies.size.type=SizeBasedTriggeringPolicy
appender.testrail.policies.size.size=10MB
appender.testrail.strategy.type=DefaultRolloverStrategy
appender.testrail.strategy.max=10

View File

@@ -9,7 +9,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-tests</artifactId>
<version>20.34</version>
<version>20.50-SNAPSHOT</version>
</parent>
<developers>

View File

@@ -1,26 +0,0 @@
# Root logger option
log4j.rootLogger=INFO, file, stdout
# Direct log messages to a log file
log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.File=./target/reports/alfresco-tas.log
log4j.appender.file.MaxBackupIndex=10
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=[%t] %d{HH:mm:ss} %-5p %c{1}:%L - %m%n
# Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[%t] %d{HH:mm:ss} %-5p %c{1}:%L - %m%n
# TestRail particular log file
# Direct log messages to a log file
log4j.appender.testrailLog=org.apache.log4j.RollingFileAppender
log4j.appender.testrailLog.File=./target/reports/alfresco-testrail.log
log4j.appender.testrailLog.MaxBackupIndex=10
log4j.appender.testrailLog.layout=org.apache.log4j.PatternLayout
log4j.appender.testrailLog.layout.ConversionPattern=%d{HH:mm:ss} %-5p %c{1}:%L - %m%n
log4j.category.testrail=INFO, testrailLog
log4j.additivity.testrail=false

View File

@@ -0,0 +1,42 @@
# Root logger option
rootLogger.level=info
rootLogger.appenderRef.stdout.ref=ConsoleAppender
rootLogger.appenderRef.rolling.ref=RollingAppender
###### File appender definition #######
appender.rolling.type=RollingFile
appender.rolling.name=RollingAppender
appender.rolling.fileName=./target/reports/alfresco-tas.log
appender.rolling.filePattern=./target/reports/alfresco-tas.log.%i
appender.rolling.layout.type=PatternLayout
appender.rolling.layout.pattern=[%t] %d{HH:mm:ss} %-5p %c{1}:%L - %replace{%m}{[\r\n]+}{}%n
appender.rolling.policies.type = Policies
appender.rolling.policies.size.type=SizeBasedTriggeringPolicy
appender.rolling.policies.size.size=10MB
appender.rolling.strategy.type=DefaultRolloverStrategy
appender.rolling.strategy.max=10
###### Console appender definition #######
appender.console.type=Console
appender.console.name=ConsoleAppender
appender.console.layout.type=PatternLayout
appender.console.layout.pattern=[%t] %d{HH:mm:ss} %-5p %c{1}:%L - %replace{%m}{[\r\n]+}{}%n
# TestRail particular log file
# Direct log messages to a log file
logger.testrail.name=testrail
logger.testrail.level=info
logger.testrail.additivity=false
logger.testrail.appenderRef.testrail.ref=TestrailAppender
appender.testrail.name=TestrailAppender
appender.testrail.type=RollingFile
appender.testrail.fileName=./target/reports/alfresco-testrail.log
appender.testrail.filePattern=./target/reports/alfresco-testrail.log.%i
appender.testrail.layout.type=PatternLayout
appender.testrail.layout.pattern=%d{HH:mm:ss} %-5p %c{1}:%L - %replace{%m}{[\r\n]+}{}%n
appender.testrail.policies.type=Policies
appender.testrail.policies.size.type=SizeBasedTriggeringPolicy
appender.testrail.policies.size.size=10MB
appender.testrail.strategy.type=DefaultRolloverStrategy
appender.testrail.strategy.max=10

View File

@@ -8,7 +8,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-tests</artifactId>
<version>20.34</version>
<version>20.50-SNAPSHOT</version>
</parent>
<properties>

View File

@@ -0,0 +1,43 @@
package org.alfresco.rest.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.core.IRestModel;
import org.alfresco.utility.model.TestModel;
/**
* Generated by 'mpichura' on '2022-12-01 13:41' from 'Alfresco Content Services REST API' swagger file
* Generated from 'Alfresco Content Services REST API' swagger file
* Base Path {@linkplain /alfresco/api/-default-/public/alfresco/versions/1}
*/
public class RestCategoryBodyModel extends TestModel implements IRestModel<RestCategoryBodyModel>
{
@JsonProperty(value = "entry")
RestCategoryBodyModel model;
@Override
public RestCategoryBodyModel onModel()
{
return model;
}
/**
The name of the category.
This must be unique within the parent category.
*/
@JsonProperty(required = true)
private String name;
public String getName()
{
return this.name;
}
public void setName(String name)
{
this.name = name;
}
}

View File

@@ -0,0 +1,40 @@
package org.alfresco.rest.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.core.IRestModel;
import org.alfresco.utility.model.TestModel;
/**
* Generated by 'mpichura' on '2022-12-01 13:41' from 'Alfresco Content Services REST API' swagger file
* Generated from 'Alfresco Content Services REST API' swagger file
* Base Path {@linkplain /alfresco/api/-default-/public/alfresco/versions/1}
*/
public class RestCategoryLinkBodyModel extends TestModel implements IRestModel<RestCategoryLinkBodyModel>
{
@JsonProperty(value = "entry")
RestCategoryLinkBodyModel model;
@Override
public RestCategoryLinkBodyModel onModel()
{
return model;
}
/**
The identifier of the category.
*/
@JsonProperty(required = true)
private String id;
public String getId()
{
return this.id;
}
public void setId(String id)
{
this.id = id;
}
}

View File

@@ -0,0 +1,179 @@
package org.alfresco.rest.model;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.core.IRestModel;
import org.alfresco.utility.model.TestModel;
/**
* Generated by 'mpichura' on '2022-12-01 13:41' from 'Alfresco Content Services REST API' swagger file
* Generated from 'Alfresco Content Services REST API' swagger file
* Base Path {@linkplain /alfresco/api/-default-/public/alfresco/versions/1}
*/
public class RestCategoryModel extends TestModel implements IRestModel<RestCategoryModel>
{
@JsonProperty(value = "entry")
RestCategoryModel model;
@Override
public RestCategoryModel onModel()
{
return model;
}
/**
The identifier for the category.
*/
@JsonProperty(required = true)
private String id;
/**
The name of the category.
This must be unique within the parent category.
*/
@JsonProperty(required = true)
private String name;
/**
The id of the parent category (or -root- if this is a top level category).
*/
private String parentId;
/**
True if the category has at least one child category.
*/
private boolean hasChildren;
/**
The number of nodes that are assigned to this category.
*/
private long count;
public String getId()
{
return this.id;
}
public void setId(String id)
{
this.id = id;
}
public String getName()
{
return this.name;
}
public void setName(String name)
{
this.name = name;
}
public String getParentId()
{
return this.parentId;
}
public void setParentId(String parentId)
{
this.parentId = parentId;
}
public boolean getHasChildren()
{
return this.hasChildren;
}
public void setHasChildren(boolean hasChildren)
{
this.hasChildren = hasChildren;
}
public long getCount()
{
return this.count;
}
public void setCount(long count)
{
this.count = count;
}
@Override
public boolean equals(Object o)
{
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
RestCategoryModel that = (RestCategoryModel) o;
return Objects.equals(id, that.id);
}
@Override
public int hashCode()
{
return Objects.hash(id);
}
@Override
public String toString()
{
return "RestCategoryModel{" +
"id='" + id + '\'' +
", name='" + name + '\'' +
", parentId='" + parentId + '\'' +
", hasChildren=" + hasChildren +
", count=" + count +
'}';
}
public static Builder builder()
{
return new Builder();
}
public static class Builder
{
private String id;
private String name;
private String parentId;
private boolean hasChildren;
public Builder id(String id)
{
this.id = id;
return this;
}
public Builder name(String name)
{
this.name = name;
return this;
}
public Builder parentId(String parentId)
{
this.parentId = parentId;
return this;
}
public Builder hasChildren(boolean hasChildren)
{
this.hasChildren = hasChildren;
return this;
}
public RestCategoryModel create()
{
final RestCategoryModel category = new RestCategoryModel();
category.setId(id);
category.setName(name);
category.setParentId(parentId);
category.setHasChildren(hasChildren);
return category;
}
}
}

View File

@@ -0,0 +1,35 @@
/*
* #%L
* Alfresco Remote API
* %%
* Copyright (C) 2005 - 2022 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.model;
import org.alfresco.rest.core.RestModels;
public class RestCategoryModelsCollection extends RestModels<RestCategoryModel, RestCandidateModelsCollection>
{
}

View File

@@ -0,0 +1,118 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 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.requests;
import static org.alfresco.rest.core.JsonBodyGenerator.arrayToJson;
import java.util.List;
import org.alfresco.rest.core.RestRequest;
import org.alfresco.rest.core.RestWrapper;
import org.alfresco.rest.model.RestCategoryModel;
import org.alfresco.rest.model.RestCategoryModelsCollection;
import org.springframework.http.HttpMethod;
public class Categories extends ModelRequest<Categories>
{
private RestCategoryModel category;
public Categories(RestWrapper restWrapper, RestCategoryModel category)
{
super(restWrapper);
this.category = category;
}
/**
* Retrieves a category with ID using GET call on "/categories/{categoryId}"
*
* @return RestCategoryModel
*/
public RestCategoryModel getCategory()
{
RestRequest request = RestRequest
.simpleRequest(HttpMethod.GET, "categories/{categoryId}?{parameters}", category.getId(), restWrapper.getParameters());
return restWrapper.processModel(RestCategoryModel.class, request);
}
/**
* Create several categories in one request.
*
* @param restCategoryModels The list of categories to create.
* @return The list of created categories with additional data populated by the repository.
*/
public RestCategoryModelsCollection createCategoriesList(List<RestCategoryModel> restCategoryModels) {
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, arrayToJson(restCategoryModels), "categories/{categoryId}/subcategories", category.getId());
return restWrapper.processModels(RestCategoryModelsCollection.class, request);
}
/**
* Create single category.
*
* @param restCategoryModel The category to create.
* @return Created category with additional data populated by the repository.
*/
public RestCategoryModel createSingleCategory(RestCategoryModel restCategoryModel)
{
RestRequest request = RestRequest
.requestWithBody(HttpMethod.POST, restCategoryModel.toJson(), "categories/{categoryId}/subcategories", category.getId());
return restWrapper.processModel(RestCategoryModel.class, request);
}
/**
* Get parent category children.
*
* @return The list of child categories.
*/
public RestCategoryModelsCollection getCategoryChildren()
{
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "categories/{categoryId}/subcategories", category.getId());
return restWrapper.processModels(RestCategoryModelsCollection.class, request);
}
/**
* Update single category.
* - PUT /categories/{categoryId}
*
* @param restCategoryModel The categories to update.
* @return Created category with additional data populated by the repository.
*/
public RestCategoryModel updateCategory(RestCategoryModel restCategoryModel)
{
RestRequest request = RestRequest.requestWithBody(HttpMethod.PUT, restCategoryModel.toJson(), "categories/{categoryId}", category.getId());
return restWrapper.processModel(RestCategoryModel.class, request);
}
/**
* Delete category.
* - DELETE /categories/{categoryId}
*/
public void deleteCategory()
{
RestRequest request = RestRequest.
simpleRequest(HttpMethod.DELETE, "/categories/{categoryId}", category.getId());
restWrapper.processEmptyModel(request);
}
}

View File

@@ -26,12 +26,14 @@
package org.alfresco.rest.requests.coreAPI;
import org.alfresco.rest.core.RestWrapper;
import org.alfresco.rest.model.RestCategoryModel;
import org.alfresco.rest.model.RestDownloadsModel;
import org.alfresco.rest.model.RestSiteModelsCollection;
import org.alfresco.rest.model.RestTagModel;
import org.alfresco.rest.model.RestTagModelsCollection;
import org.alfresco.rest.requests.Actions;
import org.alfresco.rest.requests.Audit;
import org.alfresco.rest.requests.Categories;
import org.alfresco.rest.requests.ContentStorageInformation;
import org.alfresco.rest.requests.Downloads;
import org.alfresco.rest.requests.Groups;
@@ -184,6 +186,12 @@ public class RestCoreAPI extends ModelRequest<RestCoreAPI>
{
return new Tags(tag, restWrapper).getTag();
}
public Categories usingCategory(RestCategoryModel categoryModel)
{
return new Categories(restWrapper, categoryModel);
}
public Queries usingQueries()
{

View File

@@ -1,26 +0,0 @@
# Root logger option
log4j.rootLogger=INFO, file, stdout
# Direct log messages to a log file
log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.File=./target/reports/alfresco-tas.log
log4j.appender.file.MaxBackupIndex=10
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=[%t] %d{HH:mm:ss} %-5p %c{1}:%L - %m%n
# Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[%t] %d{HH:mm:ss} %-5p %c{1}:%L - %m%n
# TestRail particular log file
# Direct log messages to a log file
log4j.appender.testrailLog=org.apache.log4j.RollingFileAppender
log4j.appender.testrailLog.File=./target/reports/alfresco-testrail.log
log4j.appender.testrailLog.MaxBackupIndex=10
log4j.appender.testrailLog.layout=org.apache.log4j.PatternLayout
log4j.appender.testrailLog.layout.ConversionPattern=%d{HH:mm:ss} %-5p %c{1}:%L - %m%n
log4j.category.testrail=INFO, testrailLog
log4j.additivity.testrail=false

View File

@@ -0,0 +1,42 @@
# Root logger option
rootLogger.level=info
rootLogger.appenderRef.stdout.ref=ConsoleAppender
rootLogger.appenderRef.rolling.ref=RollingAppender
###### File appender definition #######
appender.rolling.type=RollingFile
appender.rolling.name=RollingAppender
appender.rolling.fileName=./target/reports/alfresco-tas.log
appender.rolling.filePattern=./target/reports/alfresco-tas.log.%i
appender.rolling.layout.type=PatternLayout
appender.rolling.layout.pattern=[%t] %d{HH:mm:ss} %-5p %c{1}:%L - %replace{%m}{[\r\n]+}{}%n
appender.rolling.policies.type = Policies
appender.rolling.policies.size.type=SizeBasedTriggeringPolicy
appender.rolling.policies.size.size=10MB
appender.rolling.strategy.type=DefaultRolloverStrategy
appender.rolling.strategy.max=10
###### Console appender definition #######
appender.console.type=Console
appender.console.name=ConsoleAppender
appender.console.layout.type=PatternLayout
appender.console.layout.pattern=[%t] %d{HH:mm:ss} %-5p %c{1}:%L - %replace{%m}{[\r\n]+}{}%n
# TestRail particular log file
# Direct log messages to a log file
logger.testrail.name=testrail
logger.testrail.level=info
logger.testrail.additivity=false
logger.testrail.appenderRef.testrail.ref=TestrailAppender
appender.testrail.name=TestrailAppender
appender.testrail.type=RollingFile
appender.testrail.fileName=./target/reports/alfresco-testrail.log
appender.testrail.filePattern=./target/reports/alfresco-testrail.log.%i
appender.testrail.layout.type=PatternLayout
appender.testrail.layout.pattern=%d{HH:mm:ss} %-5p %c{1}:%L - %replace{%m}{[\r\n]+}{}%n
appender.testrail.policies.type=Policies
appender.testrail.policies.size.type=SizeBasedTriggeringPolicy
appender.testrail.policies.size.size=10MB
appender.testrail.strategy.type=DefaultRolloverStrategy
appender.testrail.strategy.max=10

View File

@@ -0,0 +1,91 @@
/*
* #%L
* Alfresco Remote API
* %%
* Copyright (C) 2005 - 2022 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.categories;
import static org.alfresco.utility.data.RandomData.getRandomName;
import static org.alfresco.utility.report.log.Step.STEP;
import static org.springframework.http.HttpStatus.CREATED;
import org.alfresco.rest.RestTest;
import org.alfresco.rest.model.RestCategoryModel;
import org.alfresco.utility.model.UserModel;
import org.testng.annotations.BeforeClass;
abstract class CategoriesRestTest extends RestTest
{
protected static final String ROOT_CATEGORY_ID = "-root-";
protected static final String CATEGORY_NAME_PREFIX = "CategoryName";
protected static final String FIELD_NAME = "name";
protected static final String FIELD_ID = "id";
protected static final String FIELD_PARENT_ID = "parentId";
protected static final String FIELD_HAS_CHILDREN = "hasChildren";
protected UserModel user;
@BeforeClass(alwaysRun = true)
public void dataPreparation() throws Exception
{
STEP("Create a user");
user = dataUser.createRandomTestUser();
}
protected RestCategoryModel prepareCategoryUnderRoot()
{
return prepareCategoryUnder(ROOT_CATEGORY_ID);
}
protected RestCategoryModel prepareCategoryUnder(final String parentId)
{
final RestCategoryModel parentCategory = createCategoryModelWithId(parentId);
final RestCategoryModel categoryModel = createCategoryModelWithName(getRandomName(CATEGORY_NAME_PREFIX));
final RestCategoryModel createdCategory = restClient.authenticateUser(dataUser.getAdminUser())
.withCoreAPI()
.usingCategory(parentCategory)
.createSingleCategory(categoryModel);
restClient.assertStatusCodeIs(CREATED);
return createdCategory;
}
protected RestCategoryModel createCategoryModelWithId(final String id)
{
return createCategoryModelWithIdAndName(id, null);
}
protected RestCategoryModel createCategoryModelWithName(final String name)
{
return createCategoryModelWithIdAndName(null, name);
}
protected RestCategoryModel createCategoryModelWithIdAndName(final String id, final String name)
{
return RestCategoryModel.builder()
.id(id)
.name(name)
.create();
}
}

View File

@@ -0,0 +1,240 @@
/*
* #%L
* Alfresco Remote API
* %%
* Copyright (C) 2005 - 2022 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.categories;
import static org.alfresco.utility.report.log.Step.STEP;
import static org.springframework.http.HttpStatus.BAD_REQUEST;
import static org.springframework.http.HttpStatus.CREATED;
import static org.springframework.http.HttpStatus.FORBIDDEN;
import static org.springframework.http.HttpStatus.NOT_FOUND;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import org.alfresco.rest.model.RestCategoryModel;
import org.alfresco.rest.model.RestCategoryModelsCollection;
import org.alfresco.utility.data.RandomData;
import org.alfresco.utility.model.FolderModel;
import org.alfresco.utility.model.SiteModel;
import org.alfresco.utility.model.TestGroup;
import org.apache.commons.lang3.StringUtils;
import org.testng.annotations.Test;
public class CreateCategoriesTests extends CategoriesRestTest
{
/**
* Check we can create a category as direct child of root category
*/
@Test(groups = {TestGroup.REST_API})
public void testCreateCategoryUnderRoot()
{
STEP("Create a category under root category (as admin)");
final RestCategoryModel rootCategory = createCategoryModelWithId(ROOT_CATEGORY_ID);
final RestCategoryModel aCategory = createCategoryModelWithName(RandomData.getRandomName("Category"));
final RestCategoryModel createdCategory = restClient.authenticateUser(dataUser.getAdminUser())
.withCoreAPI()
.usingCategory(rootCategory)
.createSingleCategory(aCategory);
restClient.assertStatusCodeIs(CREATED);
createdCategory.assertThat().field(FIELD_NAME).is(aCategory.getName());
createdCategory.assertThat().field(FIELD_PARENT_ID).is(rootCategory.getId());
createdCategory.assertThat().field(FIELD_HAS_CHILDREN).is(false);
}
/**
* Check we get 400 error when attempting to create a category with empty name
*/
@Test(groups = {TestGroup.REST_API})
public void testCreateCategoryWithoutName_andFail()
{
STEP("Create a category under root category (as admin)");
final RestCategoryModel rootCategory = createCategoryModelWithId(ROOT_CATEGORY_ID);
final RestCategoryModel aCategory = createCategoryModelWithName(StringUtils.EMPTY);
restClient.authenticateUser(dataUser.getAdminUser())
.withCoreAPI()
.usingCategory(rootCategory)
.createSingleCategory(aCategory);
restClient.assertStatusCodeIs(BAD_REQUEST).assertLastError().containsSummary("Category name must not be null or empty");
}
/**
* Check we can create several categories as children of a created category
*/
@Test(groups = {TestGroup.REST_API})
public void testCreateSeveralSubCategories()
{
STEP("Create a category under root category (as admin)");
final RestCategoryModel rootCategory = createCategoryModelWithId(ROOT_CATEGORY_ID);
final RestCategoryModel aCategory = createCategoryModelWithName(RandomData.getRandomName("Category"));
final RestCategoryModel createdCategory = restClient.authenticateUser(dataUser.getAdminUser())
.withCoreAPI()
.usingCategory(rootCategory)
.createSingleCategory(aCategory);
restClient.assertStatusCodeIs(CREATED);
createdCategory.assertThat().field(FIELD_NAME).is(aCategory.getName())
.assertThat().field(FIELD_PARENT_ID).is(rootCategory.getId())
.assertThat().field(FIELD_HAS_CHILDREN).is(false)
.assertThat().field(FIELD_ID).isNotEmpty();
STEP("Create two categories under the previously created (as admin)");
final int categoriesNumber = 2;
final List<RestCategoryModel> categoriesToCreate = getCategoriesToCreate(categoriesNumber);
final RestCategoryModelsCollection createdSubCategories = restClient.authenticateUser(dataUser.getAdminUser())
.withCoreAPI()
.usingCategory(createdCategory)
.createCategoriesList(categoriesToCreate);
restClient.assertStatusCodeIs(CREATED);
createdSubCategories.assertThat()
.entriesListCountIs(categoriesToCreate.size());
IntStream.range(0, categoriesNumber)
.forEach(i -> createdSubCategories.getEntries().get(i).onModel()
.assertThat().field(FIELD_NAME).is(categoriesToCreate.get(i).getName())
.assertThat().field(FIELD_PARENT_ID).is(createdCategory.getId())
.assertThat().field(FIELD_HAS_CHILDREN).is(false)
.assertThat().field(FIELD_ID).isNotEmpty()
);
STEP("Get the parent category and check if it now has children (as regular user)");
final RestCategoryModel parentCategoryFromGet = restClient.authenticateUser(user)
.withCoreAPI()
.usingCategory(createdCategory)
.getCategory();
parentCategoryFromGet.assertThat().field(FIELD_HAS_CHILDREN).is(true);
}
/**
* Check we can create over 100 categories as children of a created category and pagination information is proper.
*/
@Test(groups = {TestGroup.REST_API})
public void testCreateOver100SubCategories()
{
STEP("Create a category under root category (as admin)");
final RestCategoryModel rootCategory = createCategoryModelWithId(ROOT_CATEGORY_ID);
final RestCategoryModel aCategory = createCategoryModelWithName(RandomData.getRandomName("Category"));
final RestCategoryModel createdCategory = restClient.authenticateUser(dataUser.getAdminUser())
.withCoreAPI()
.usingCategory(rootCategory)
.createSingleCategory(aCategory);
restClient.assertStatusCodeIs(CREATED);
createdCategory.assertThat().field(FIELD_NAME).is(aCategory.getName())
.assertThat().field(FIELD_PARENT_ID).is(rootCategory.getId())
.assertThat().field(FIELD_HAS_CHILDREN).is(false)
.assertThat().field(FIELD_ID).isNotEmpty();
STEP("Create more than a hundred categories under the previously created (as admin)");
final int categoriesNumber = 120;
final List<RestCategoryModel> categoriesToCreate = getCategoriesToCreate(categoriesNumber);
final RestCategoryModelsCollection createdSubCategories = restClient.authenticateUser(dataUser.getAdminUser())
.withCoreAPI()
.usingCategory(createdCategory)
.createCategoriesList(categoriesToCreate);
restClient.assertStatusCodeIs(CREATED);
createdSubCategories.assertThat()
.entriesListCountIs(categoriesToCreate.size());
IntStream.range(0, categoriesNumber)
.forEach(i -> createdSubCategories.getEntries().get(i).onModel()
.assertThat().field(FIELD_NAME).is(categoriesToCreate.get(i).getName())
.assertThat().field(FIELD_PARENT_ID).is(createdCategory.getId())
.assertThat().field(FIELD_HAS_CHILDREN).is(false)
.assertThat().field(FIELD_ID).isNotEmpty()
);
createdSubCategories.getPagination().assertThat().field("count").is(categoriesNumber)
.assertThat().field("totalItems").is(categoriesNumber)
.assertThat().field("maxItems").is(categoriesNumber)
.assertThat().field("skipCount").is(0)
.assertThat().field("hasMoreItems").is(false);
}
/**
* Check we cannot create a category as direct child of root category as non-admin user
*/
@Test(groups = {TestGroup.REST_API})
public void testCreateCategoryUnderRootAsRegularUser_andFail()
{
STEP("Create a category under root category (as user)");
final RestCategoryModel rootCategory = createCategoryModelWithId(ROOT_CATEGORY_ID);
final RestCategoryModel aCategory = createCategoryModelWithName(RandomData.getRandomName("Category"));
restClient.authenticateUser(user)
.withCoreAPI()
.usingCategory(rootCategory)
.createSingleCategory(aCategory);
restClient.assertStatusCodeIs(FORBIDDEN).assertLastError().containsSummary("Current user does not have permission to manage a category");
}
/**
* Check we cannot create a category under non existing parent node
*/
@Test(groups = {TestGroup.REST_API})
public void testCreateCategoryUnderNonExistingParent_andFail()
{
STEP("Create a category under non existing category node (as admin)");
final String id = "non-existing-node-id";
final RestCategoryModel rootCategory = createCategoryModelWithId(id);
final RestCategoryModel aCategory = createCategoryModelWithName(RandomData.getRandomName("Category"));
restClient.authenticateUser(dataUser.getAdminUser())
.withCoreAPI()
.usingCategory(rootCategory)
.createSingleCategory(aCategory);
restClient.assertStatusCodeIs(NOT_FOUND).assertLastError().containsSummary("The entity with id: " + id + " was not found");
}
/**
* Check we cannot create a category under a node which is not a category
*/
@Test(groups = {TestGroup.REST_API})
public void testCreateCategoryUnderFolderNode_andFail()
{
STEP("Create a site and a folder inside it");
final SiteModel site = dataSite.usingUser(user).createPublicRandomSite();
final FolderModel folder = dataContent.usingUser(user).usingSite(site).createFolder();
STEP("Create a category under folder node (as admin)");
final RestCategoryModel rootCategory = createCategoryModelWithId(folder.getNodeRef());
final RestCategoryModel aCategory = createCategoryModelWithName(RandomData.getRandomName("Category"));
restClient.authenticateUser(dataUser.getAdminUser())
.withCoreAPI()
.usingCategory(rootCategory)
.createSingleCategory(aCategory);
restClient.assertStatusCodeIs(BAD_REQUEST).assertLastError().containsSummary("Node id does not refer to a valid category");
}
static List<RestCategoryModel> getCategoriesToCreate(final int count)
{
return IntStream.range(0, count)
.mapToObj(i -> RestCategoryModel.builder().name(RandomData.getRandomName("SubCategory")).create())
.collect(Collectors.toList());
}
}

View File

@@ -0,0 +1,102 @@
/*
* #%L
* Alfresco Remote API
* %%
* Copyright (C) 2005 - 2022 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.categories;
import static org.alfresco.utility.report.log.Step.STEP;
import static org.springframework.http.HttpStatus.BAD_REQUEST;
import static org.springframework.http.HttpStatus.FORBIDDEN;
import static org.springframework.http.HttpStatus.NOT_FOUND;
import static org.springframework.http.HttpStatus.NO_CONTENT;
import org.alfresco.rest.model.RestCategoryModel;
import org.alfresco.utility.model.FolderModel;
import org.alfresco.utility.model.SiteModel;
import org.alfresco.utility.model.TestGroup;
import org.testng.annotations.Test;
public class DeleteCategoriesTests extends CategoriesRestTest
{
/**
* Check we can delete a category.
*/
@Test(groups = {TestGroup.REST_API})
public void testDeleteCategory()
{
STEP("Create a category and send a request to delete it.");
RestCategoryModel aCategory = prepareCategoryUnderRoot();
restClient.authenticateUser(dataUser.getAdminUser()).withCoreAPI().usingCategory(aCategory).deleteCategory();
restClient.assertStatusCodeIs(NO_CONTENT);
STEP("Ensure that the category has been deleted by sending a GET request and receiving 404.");
restClient.authenticateUser(user).withCoreAPI().usingCategory(aCategory).getCategory();
restClient.assertStatusCodeIs(NOT_FOUND);
}
/**
* Check we get an error when trying to delete a category as a non-admin user.
*/
@Test(groups = {TestGroup.REST_API})
public void testDeleteCategoryAsRegularUser_andFail()
{
RestCategoryModel aCategory = prepareCategoryUnderRoot();
restClient.authenticateUser(user).withCoreAPI().usingCategory(aCategory).deleteCategory();
restClient.assertStatusCodeIs(FORBIDDEN).assertLastError().containsSummary("Current user does not have permission to manage a category");
}
/**
* Check we receive 404 error when trying to delete a category with a non-existent node id.
*/
@Test(groups = {TestGroup.REST_API})
public void testDeleteNonExistentCategory()
{
STEP("Get category with non-existent id");
final String id = "non-existing-dummy-id";
final RestCategoryModel rootCategory = createCategoryModelWithId(id);
STEP("Attempt to delete category with non-existent id and receive 404");
restClient.authenticateUser(dataUser.getAdminUser()).withCoreAPI().usingCategory(rootCategory).deleteCategory();
restClient.assertStatusCodeIs(NOT_FOUND);
}
/**
* Attempt to delete a category when providing a node id that doesn't belong to a category
*/
@Test(groups = {TestGroup.REST_API})
public void testDeleteCategory_givenNonCategoryNodeId()
{
STEP("Create a site and a folder inside it");
final SiteModel site = dataSite.usingUser(user).createPublicRandomSite();
final FolderModel folder = dataContent.usingUser(user).usingSite(site).createFolder();
String id = folder.getNodeRef();
STEP("Create a category, set its id to the folder id and attempt to delete it");
final RestCategoryModel aCategory = createCategoryModelWithId(id);
restClient.authenticateUser(dataUser.getAdminUser()).withCoreAPI().usingCategory(aCategory).deleteCategory();
restClient.assertStatusCodeIs(BAD_REQUEST).assertLastError().containsSummary("Node id does not refer to a valid category");
}
}

View File

@@ -0,0 +1,195 @@
/*
* #%L
* Alfresco Remote API
* %%
* Copyright (C) 2005 - 2022 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.categories;
import static org.alfresco.utility.report.log.Step.STEP;
import static org.springframework.http.HttpStatus.BAD_REQUEST;
import static org.springframework.http.HttpStatus.CREATED;
import static org.springframework.http.HttpStatus.NOT_FOUND;
import static org.springframework.http.HttpStatus.OK;
import static org.testng.Assert.assertTrue;
import java.util.List;
import java.util.stream.Collectors;
import org.alfresco.rest.model.RestCategoryModel;
import org.alfresco.rest.model.RestCategoryModelsCollection;
import org.alfresco.utility.data.RandomData;
import org.alfresco.utility.model.FolderModel;
import org.alfresco.utility.model.SiteModel;
import org.alfresco.utility.model.TestGroup;
import org.testng.annotations.Test;
public class GetCategoriesTests extends CategoriesRestTest
{
private static final List<String> DEFAULT_ROOT_CATEGORIES = List.of("Software Document Classification", "Languages", "Regions", "Tags");
private static final String NON_EXISTING_CATEGORY_ID = "non-existing-category-id";
/**
* Check we can get a category which we just created in as direct child of root category
*/
@Test(groups = {TestGroup.REST_API})
public void testGetCategoryById()
{
STEP("Create a category under root category (as admin)");
final RestCategoryModel rootCategory = createCategoryModelWithId(ROOT_CATEGORY_ID);
final RestCategoryModel aCategory = createCategoryModelWithName(RandomData.getRandomName("Category"));
final RestCategoryModel createdCategory = restClient.authenticateUser(dataUser.getAdminUser())
.withCoreAPI()
.usingCategory(rootCategory)
.createSingleCategory(aCategory);
restClient.assertStatusCodeIs(CREATED);
createdCategory.assertThat().field("name").is(aCategory.getName());
createdCategory.assertThat().field("parentId").is(rootCategory.getId());
createdCategory.assertThat().field("hasChildren").is(false);
STEP("Get the created category (as regular user)");
final RestCategoryModel categoryFromGet =
restClient.authenticateUser(user).withCoreAPI().usingCategory(createdCategory).getCategory();
restClient.assertStatusCodeIs(OK);
categoryFromGet.assertThat().isEqualTo(createdCategory);
}
/**
* Check we get an error when passing -root- as category id
*/
@Test(groups = {TestGroup.REST_API})
public void testGetCategoryByIdProvidingRootAsId()
{
STEP("Get category with -root- as id");
final RestCategoryModel rootCategory = createCategoryModelWithId(ROOT_CATEGORY_ID);
restClient.authenticateUser(user).withCoreAPI().usingCategory(rootCategory).getCategory();
restClient.assertStatusCodeIs(BAD_REQUEST).assertLastError().containsSummary("Node id does not refer to a valid category");
}
/**
* Check we get an error when passing folder node id as category id
*/
@Test(groups = {TestGroup.REST_API})
public void testGetCategoryByIdProvidingFolderAsId()
{
STEP("Create a site and a folder inside it");
final SiteModel site = dataSite.usingUser(user).createPublicRandomSite();
final FolderModel folder = dataContent.usingUser(user).usingSite(site).createFolder();
STEP("Get category with folder id passed as id");
final RestCategoryModel rootCategory = createCategoryModelWithId(folder.getNodeRef());
restClient.authenticateUser(user).withCoreAPI().usingCategory(rootCategory).getCategory();
restClient.assertStatusCodeIs(BAD_REQUEST).assertLastError().containsSummary("Node id does not refer to a valid category");
}
/**
* Check we get an error when passing non existing as category id
*/
@Test(groups = {TestGroup.REST_API})
public void testGetCategoryByIdProvidingNonExistingId()
{
STEP("Get category with id which does not exist");
final String id = NON_EXISTING_CATEGORY_ID;
final RestCategoryModel rootCategory = createCategoryModelWithId(id);
restClient.authenticateUser(user).withCoreAPI().usingCategory(rootCategory).getCategory();
restClient.assertStatusCodeIs(NOT_FOUND).assertLastError().containsSummary(id);
}
/**
* Check we can get children category of a root category
*/
@Test(groups = {TestGroup.REST_API})
public void testGetCategoryChildren()
{
STEP("Get category children with -root- as parent id");
final RestCategoryModel rootCategory = createCategoryModelWithId(ROOT_CATEGORY_ID);
RestCategoryModelsCollection childCategoriesList =
restClient.authenticateUser(user).withCoreAPI().usingCategory(rootCategory).getCategoryChildren();
restClient.assertStatusCodeIs(OK);
childCategoriesList.assertThat().entriesListIsNotEmpty();
assertTrue(childCategoriesList.getEntries().stream()
.map(RestCategoryModel::onModel)
.map(RestCategoryModel::getName)
.collect(Collectors.toList())
.containsAll(DEFAULT_ROOT_CATEGORIES));
STEP("Create a new category under root and make sure it is returned as one of root's children");
final RestCategoryModel aCategory = createCategoryModelWithName(RandomData.getRandomName("newCategoryUnderRoot"));
final RestCategoryModel createdCategory = restClient.authenticateUser(dataUser.getAdminUser())
.withCoreAPI()
.usingCategory(rootCategory)
.createSingleCategory(aCategory);
restClient.assertStatusCodeIs(CREATED);
childCategoriesList = restClient.authenticateUser(user).withCoreAPI().usingCategory(rootCategory).getCategoryChildren();
restClient.assertStatusCodeIs(OK);
assertTrue(childCategoriesList.getEntries().stream()
.map(RestCategoryModel::onModel)
.map(RestCategoryModel::getId)
.collect(Collectors.toList())
.contains(createdCategory.getId()));
STEP("Create 2 more categories under newCategoryUnderRoot and make sure they are returned as children");
final int categoriesCount = 2;
final List<RestCategoryModel> categoriesToCreate = CreateCategoriesTests.getCategoriesToCreate(categoriesCount);
final RestCategoryModelsCollection createdSubCategories = restClient.authenticateUser(dataUser.getAdminUser())
.withCoreAPI()
.usingCategory(createdCategory)
.createCategoriesList(categoriesToCreate);
restClient.assertStatusCodeIs(CREATED);
childCategoriesList = restClient.authenticateUser(user).withCoreAPI().usingCategory(rootCategory).getCategoryChildren();
restClient.assertStatusCodeIs(OK);
childCategoriesList.getEntries().containsAll(createdSubCategories.getEntries());
}
/**
* Check we get an error when passing folder node id as parent category id when getting children.
*/
@Test(groups = {TestGroup.REST_API})
public void testGetCategoryChildrenProvidingFolderAsId()
{
STEP("Create a site and a folder inside it");
final SiteModel site = dataSite.usingUser(user).createPublicRandomSite();
final FolderModel folder = dataContent.usingUser(user).usingSite(site).createFolder();
STEP("Get category children with folder id passed as parent id");
final RestCategoryModel parentCategory = createCategoryModelWithId(folder.getNodeRef());
restClient.authenticateUser(user).withCoreAPI().usingCategory(parentCategory).getCategoryChildren();
restClient.assertStatusCodeIs(BAD_REQUEST).assertLastError().containsSummary("Node id does not refer to a valid category");
}
/**
* Check we get an error when passing a non-existent node id as parent category id when getting children.
*/
@Test(groups = {TestGroup.REST_API})
public void testGetCategoryChildrenProvidingNonExistingParent()
{
STEP("Get category with folder id passed as id");
final String parentId = NON_EXISTING_CATEGORY_ID;
final RestCategoryModel parentCategory = createCategoryModelWithId(parentId);
restClient.authenticateUser(user).withCoreAPI().usingCategory(parentCategory).getCategoryChildren();
restClient.assertStatusCodeIs(NOT_FOUND).assertLastError().containsSummary(parentId);
}
}

View File

@@ -0,0 +1,214 @@
/*
* #%L
* Alfresco Remote API
* %%
* Copyright (C) 2005 - 2022 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.categories;
import static org.alfresco.utility.data.RandomData.getRandomName;
import static org.alfresco.utility.report.log.Step.STEP;
import static org.springframework.http.HttpStatus.BAD_REQUEST;
import static org.springframework.http.HttpStatus.FORBIDDEN;
import static org.springframework.http.HttpStatus.NOT_FOUND;
import static org.springframework.http.HttpStatus.OK;
import org.alfresco.rest.model.RestCategoryModel;
import org.alfresco.utility.model.FolderModel;
import org.alfresco.utility.model.SiteModel;
import org.alfresco.utility.model.TestGroup;
import org.alfresco.utility.model.UserModel;
import org.testng.annotations.Test;
public class UpdateCategoriesTests extends CategoriesRestTest
{
private static final String CATEGORY_NEW_NAME_PREFIX = "NewCategoryName";
private static final String IGNORE_FIELD_NAME = FIELD_NAME;
/**
* Update a category (direct child of root category)
*/
@Test(groups = { TestGroup.REST_API})
public void testUpdateCategory_asAdmin()
{
STEP("Prepare as admin a category under root category");
final RestCategoryModel createdCategory = prepareCategoryUnderRoot();
STEP("Update as admin newly created category");
final String categoryNewName = getRandomName(CATEGORY_NEW_NAME_PREFIX);
final RestCategoryModel fixedCategoryModel = createCategoryModelWithName(categoryNewName);
final RestCategoryModel updatedCategory = restClient.authenticateUser(dataUser.getAdminUser())
.withCoreAPI()
.usingCategory(createdCategory)
.updateCategory(fixedCategoryModel);
restClient.assertStatusCodeIs(OK);
updatedCategory.assertThat().isEqualTo(createdCategory, IGNORE_FIELD_NAME);
updatedCategory.assertThat().field(FIELD_NAME).isNot(createdCategory.getName());
updatedCategory.assertThat().field(FIELD_NAME).is(categoryNewName);
}
/**
* Update a subcategory of root's child category
*/
@Test(groups = { TestGroup.REST_API})
public void testUpdateSubcategory_asAdmin()
{
STEP("Prepare as admin a category under root category");
final RestCategoryModel createdCategory = prepareCategoryUnderRoot();
STEP("Prepare as admin a subcategory of root's child category");
final RestCategoryModel createdSubcategory = prepareCategoryUnder(createdCategory.getId());
STEP("Update as admin newly created subcategory");
final String categoryNewName = getRandomName(CATEGORY_NEW_NAME_PREFIX);
final RestCategoryModel fixedCategoryModel = createCategoryModelWithName(categoryNewName);
final RestCategoryModel updatedCategory = restClient.authenticateUser(dataUser.getAdminUser())
.withCoreAPI()
.usingCategory(createdSubcategory)
.updateCategory(fixedCategoryModel);
restClient.assertStatusCodeIs(OK);
updatedCategory.assertThat().isEqualTo(createdSubcategory, IGNORE_FIELD_NAME);
updatedCategory.assertThat().field(FIELD_NAME).is(categoryNewName);
}
/**
* Try to update a category as a user and expect 403 (Forbidden) in response
*/
@Test(groups = { TestGroup.REST_API})
public void testUpdateCategory_asUserAndExpect403()
{
STEP("Prepare as admin a category under root category");
final RestCategoryModel createdCategory = prepareCategoryUnderRoot();
STEP("Try to update as user newly created category");
final RestCategoryModel fixedCategoryModel = createCategoryModelWithName(getRandomName(CATEGORY_NEW_NAME_PREFIX));
restClient.authenticateUser(user)
.withCoreAPI()
.usingCategory(createdCategory)
.updateCategory(fixedCategoryModel);
restClient.assertStatusCodeIs(FORBIDDEN);
}
/**
* Try to update a non-existing category and receive 404 (Not Found)
*/
@Test(groups = { TestGroup.REST_API})
public void testUpdateCategory_usingNonExistingCategoryAndExpect404()
{
STEP("Create a fake parent category");
final RestCategoryModel nonExistingCategory = createCategoryModelWithIdAndName("non-existing-dummy-id", getRandomName(CATEGORY_NAME_PREFIX));
STEP("Try to update as admin fake category");
final RestCategoryModel fixedCategoryModel = createCategoryModelWithName(getRandomName(CATEGORY_NEW_NAME_PREFIX));
restClient.authenticateUser(dataUser.getAdminUser())
.withCoreAPI()
.usingCategory(nonExistingCategory)
.updateCategory(fixedCategoryModel);
restClient.assertStatusCodeIs(NOT_FOUND);
}
/**
* Try to update a non-category (folder) node and receive 400 (Bad Request)
*/
@Test(groups = { TestGroup.REST_API})
public void testUpdateCategory_usingFolderNodeAndExpect400()
{
STEP("Prepare a site and a folder inside it");
final UserModel user = dataUser.createRandomTestUser();
final SiteModel site = dataSite.usingUser(user).createPublicRandomSite();
final FolderModel folder = dataContent.usingUser(user).usingSite(site).createFolder();
final RestCategoryModel categoryWithFolderId = createCategoryModelWithIdAndName(folder.getNodeRef(), getRandomName(CATEGORY_NAME_PREFIX));
STEP("Try to update as admin folder node as category");
final RestCategoryModel fixedCategoryModel = createCategoryModelWithName(getRandomName(CATEGORY_NEW_NAME_PREFIX));
restClient.authenticateUser(dataUser.getAdminUser())
.withCoreAPI()
.usingCategory(categoryWithFolderId)
.updateCategory(fixedCategoryModel);
restClient.assertStatusCodeIs(BAD_REQUEST);
}
/**
* Try to update a root category and receive 400 (Bad Request)
*/
@Test(groups = { TestGroup.REST_API})
public void testUpdateCategory_usingRootCategoryAndExpect400()
{
STEP("Create root category model");
final RestCategoryModel rootCategoryModel = createCategoryModelWithId(ROOT_CATEGORY_ID);
STEP("Try to update as admin root category");
final RestCategoryModel fixedCategoryModel = createCategoryModelWithName(getRandomName(CATEGORY_NEW_NAME_PREFIX));
restClient.authenticateUser(dataUser.getAdminUser())
.withCoreAPI()
.usingCategory(rootCategoryModel)
.updateCategory(fixedCategoryModel);
restClient.assertStatusCodeIs(BAD_REQUEST);
}
/**
* Try to update a category with an empty name and receive 400 (Bad Request)
*/
@Test(groups = { TestGroup.REST_API})
public void testUpdateCategory_withEmptyNameAndExpect400()
{
STEP("Prepare as admin a category under root category");
final RestCategoryModel createdCategory = prepareCategoryUnderRoot();
STEP("Try to update as admin newly created category with a category without name");
final RestCategoryModel fixedCategoryModel = createCategoryModelWithName(null);
restClient.authenticateUser(dataUser.getAdminUser())
.withCoreAPI()
.usingCategory(createdCategory)
.updateCategory(fixedCategoryModel);
restClient.assertStatusCodeIs(BAD_REQUEST);
}
/**
* Try to update a category with an invalid, but not important ID in body and receive 200 (OK)
*/
@Test(groups = { TestGroup.REST_API})
public void testUpdateCategory_withIgnoredInvalidIdInBodyAndExpect200()
{
STEP("Prepare as admin a category under root category");
final RestCategoryModel createdCategory = prepareCategoryUnderRoot();
STEP("Try to update as admin newly created category with a category with invalid ID and receive 200");
final String categoryNewName = getRandomName(CATEGORY_NEW_NAME_PREFIX);
final RestCategoryModel fixedCategoryModel = createCategoryModelWithIdAndName("non-existing-dummy-id", categoryNewName);
final RestCategoryModel updatedCategory = restClient.authenticateUser(dataUser.getAdminUser())
.withCoreAPI()
.usingCategory(createdCategory)
.updateCategory(fixedCategoryModel);
restClient.assertStatusCodeIs(OK);
updatedCategory.assertThat().field(FIELD_NAME).is(categoryNewName);
}
}

View File

@@ -56,6 +56,7 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import javax.json.Json;
import javax.json.JsonObject;
@@ -63,6 +64,7 @@ import javax.json.JsonObject;
import org.alfresco.rest.model.RestActionBodyExecTemplateModel;
import org.alfresco.rest.model.RestActionConstraintModel;
import org.alfresco.rest.model.RestCompositeConditionDefinitionModel;
import org.alfresco.rest.model.RestPaginationModel;
import org.alfresco.rest.model.RestRuleModel;
import org.alfresco.rest.model.RestRuleModelsCollection;
import org.alfresco.utility.constants.UserRole;
@@ -267,6 +269,38 @@ public class CreateRulesTests extends RulesRestTest
.assertThat().field("name").is(ruleNames.get(i)));
}
/** Check we can create over 100 rules and get them all back in response. */
@Test (groups = { TestGroup.REST_API, TestGroup.RULES })
public void createOver100Rules()
{
STEP("Create a list of 120 rules in one POST request");
final int ruleCount = 120;
final String ruleNamePrefix = "multiRule";
final List<RestRuleModel> ruleModels = IntStream.rangeClosed(1, ruleCount)
.mapToObj(i -> rulesUtils.createRuleModel(ruleNamePrefix + i))
.collect(Collectors.toList());
final FolderModel aFolder = dataContent.usingUser(user).usingSite(site).createFolder();
final RestRuleModelsCollection rules = restClient.authenticateUser(user).withPrivateAPI().usingNode(aFolder).usingDefaultRuleSet()
.createListOfRules(ruleModels);
restClient.assertStatusCodeIs(CREATED);
assertEquals("Unexpected number of rules received in response.", ruleCount, rules.getEntries().size());
IntStream.range(0, ruleModels.size()).forEach(i ->
rules.getEntries().get(i).onModel()
.assertThat().field("id").isNotNull()
.assertThat().field("name").is(ruleNamePrefix + (i + 1)));
rules.getPagination()
.assertThat().field("count").is(ruleCount)
.assertThat().field("totalItems").is(ruleCount)
.assertThat().field("maxItems").is(ruleCount)
.assertThat().field("skipCount").is(0)
.assertThat().field("hasMoreItems").is(false);
}
/** Try to create several rules with an error in one of them. */
@Test (groups = { TestGroup.REST_API, TestGroup.RULES })
public void createRulesWithOneError()

View File

@@ -26,6 +26,7 @@
package org.alfresco.rest.rules;
import static java.util.stream.Collectors.toList;
import static org.alfresco.utility.report.log.Step.STEP;
import static org.springframework.http.HttpStatus.FORBIDDEN;
import static org.springframework.http.HttpStatus.OK;

View File

@@ -1,26 +0,0 @@
# Root logger option
log4j.rootLogger=INFO, file, stdout
# Direct log messages to a log file
log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.File=./target/reports/alfresco-tas.log
log4j.appender.file.MaxBackupIndex=10
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=[%t] %d{HH:mm:ss} %-5p %c{1}:%L - %m%n
# Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[%t] %d{HH:mm:ss} %-5p %c{1}:%L - %m%n
# TestRail particular log file
# Direct log messages to a log file
log4j.appender.testrailLog=org.apache.log4j.RollingFileAppender
log4j.appender.testrailLog.File=./target/reports/alfresco-testrail.log
log4j.appender.testrailLog.MaxBackupIndex=10
log4j.appender.testrailLog.layout=org.apache.log4j.PatternLayout
log4j.appender.testrailLog.layout.ConversionPattern=%d{HH:mm:ss} %-5p %c{1}:%L - %m%n
log4j.category.testrail=INFO, testrailLog
log4j.additivity.testrail=false

View File

@@ -0,0 +1,42 @@
# Root logger option
rootLogger.level=info
rootLogger.appenderRef.stdout.ref=ConsoleAppender
rootLogger.appenderRef.rolling.ref=RollingAppender
###### File appender definition #######
appender.rolling.type=RollingFile
appender.rolling.name=RollingAppender
appender.rolling.fileName=./target/reports/alfresco-tas.log
appender.rolling.filePattern=./target/reports/alfresco-tas.log.%i
appender.rolling.layout.type=PatternLayout
appender.rolling.layout.pattern=[%t] %d{HH:mm:ss} %-5p %c{1}:%L - %replace{%m}{[\r\n]+}{}%n
appender.rolling.policies.type = Policies
appender.rolling.policies.size.type=SizeBasedTriggeringPolicy
appender.rolling.policies.size.size=10MB
appender.rolling.strategy.type=DefaultRolloverStrategy
appender.rolling.strategy.max=10
###### Console appender definition #######
appender.console.type=Console
appender.console.name=ConsoleAppender
appender.console.layout.type=PatternLayout
appender.console.layout.pattern=[%t] %d{HH:mm:ss} %-5p %c{1}:%L - %replace{%m}{[\r\n]+}{}%n
# TestRail particular log file
# Direct log messages to a log file
logger.testrail.name=testrail
logger.testrail.level=info
logger.testrail.additivity=false
logger.testrail.appenderRef.testrail.ref=TestrailAppender
appender.testrail.name=TestrailAppender
appender.testrail.type=RollingFile
appender.testrail.fileName=./target/reports/alfresco-testrail.log
appender.testrail.filePattern=./target/reports/alfresco-testrail.log.%i
appender.testrail.layout.type=PatternLayout
appender.testrail.layout.pattern=%d{HH:mm:ss} %-5p %c{1}:%L - %replace{%m}{[\r\n]+}{}%n
appender.testrail.policies.type=Policies
appender.testrail.policies.size.type=SizeBasedTriggeringPolicy
appender.testrail.policies.size.size=10MB
appender.testrail.strategy.type=DefaultRolloverStrategy
appender.testrail.strategy.max=10

View File

@@ -16,6 +16,7 @@
<package name="org.alfresco.rest.trashcan.*"/>
<package name="org.alfresco.rest.workflow.*"/>
<package name="org.alfresco.rest.models.*"/>
<package name="org.alfresco.rest.categories.*"/>
</packages>
</test>
</suite>

View File

@@ -9,7 +9,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-tests</artifactId>
<version>20.34</version>
<version>20.50-SNAPSHOT</version>
</parent>
<developers>

View File

@@ -1,17 +1,25 @@
package org.alfresco.webdav;
import java.lang.reflect.Method;
import org.alfresco.utility.data.DataContent;
import org.alfresco.utility.data.DataSite;
import org.alfresco.utility.data.DataUser;
import org.alfresco.utility.LogFactory;
import org.alfresco.utility.network.ServerHealth;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
import org.slf4j.Logger;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.BeforeSuite;
@ContextConfiguration("classpath:alfresco-webdav-context.xml")
public abstract class WebDavTest extends AbstractTestNGSpringContextTests
{
private static final Logger LOG = LogFactory.getLogger();
@Autowired
protected DataSite dataSite;
@@ -36,4 +44,16 @@ public abstract class WebDavTest extends AbstractTestNGSpringContextTests
// The webdav protocol is enabled by default.
//webDavProtocol.assertThat().protocolIsEnabled();
}
}
@BeforeMethod(alwaysRun=true)
public void showStartTestInfo(Method method)
{
LOG.info(String.format("*** STARTING Test: [%s] ***", method.getName()));
}
@AfterMethod(alwaysRun=true)
public void showEndTestInfo(Method method)
{
LOG.info(String.format("*** ENDING Test: [%s] ***", method.getName()));
}
}

View File

@@ -1,26 +0,0 @@
# Root logger option
log4j.rootLogger=INFO, file, stdout
# Direct log messages to a log file
log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.File=./target/reports/alfresco-tas.log
log4j.appender.file.MaxBackupIndex=10
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=[%t] %d{HH:mm:ss} %-5p %c{1}:%L - %m%n
# Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[%t] %d{HH:mm:ss} %-5p %c{1}:%L - %m%n
# TestRail particular log file
# Direct log messages to a log file
log4j.appender.testrailLog=org.apache.log4j.RollingFileAppender
log4j.appender.testrailLog.File=./target/reports/alfresco-testrail.log
log4j.appender.testrailLog.MaxBackupIndex=10
log4j.appender.testrailLog.layout=org.apache.log4j.PatternLayout
log4j.appender.testrailLog.layout.ConversionPattern=%d{HH:mm:ss} %-5p %c{1}:%L - %m%n
log4j.category.testrail=INFO, testrailLog
log4j.additivity.testrail=false

View File

@@ -0,0 +1,42 @@
# Root logger option
rootLogger.level=info
rootLogger.appenderRef.stdout.ref=ConsoleAppender
rootLogger.appenderRef.rolling.ref=RollingAppender
###### File appender definition #######
appender.rolling.type=RollingFile
appender.rolling.name=RollingAppender
appender.rolling.fileName=./target/reports/alfresco-tas.log
appender.rolling.filePattern=./target/reports/alfresco-tas.log.%i
appender.rolling.layout.type=PatternLayout
appender.rolling.layout.pattern=[%t] %d{HH:mm:ss} %-5p %c{1}:%L - %replace{%m}{[\r\n]+}{}%n
appender.rolling.policies.type = Policies
appender.rolling.policies.size.type=SizeBasedTriggeringPolicy
appender.rolling.policies.size.size=10MB
appender.rolling.strategy.type=DefaultRolloverStrategy
appender.rolling.strategy.max=10
###### Console appender definition #######
appender.console.type=Console
appender.console.name=ConsoleAppender
appender.console.layout.type=PatternLayout
appender.console.layout.pattern=[%t] %d{HH:mm:ss} %-5p %c{1}:%L - %replace{%m}{[\r\n]+}{}%n
# TestRail particular log file
# Direct log messages to a log file
logger.testrail.name=testrail
logger.testrail.level=info
logger.testrail.additivity=false
logger.testrail.appenderRef.testrail.ref=TestrailAppender
appender.testrail.name=TestrailAppender
appender.testrail.type=RollingFile
appender.testrail.fileName=./target/reports/alfresco-testrail.log
appender.testrail.filePattern=./target/reports/alfresco-testrail.log.%i
appender.testrail.layout.type=PatternLayout
appender.testrail.layout.pattern=%d{HH:mm:ss} %-5p %c{1}:%L - %replace{%m}{[\r\n]+}{}%n
appender.testrail.policies.type=Policies
appender.testrail.policies.size.type=SizeBasedTriggeringPolicy
appender.testrail.policies.size.size=10MB
appender.testrail.strategy.type=DefaultRolloverStrategy
appender.testrail.strategy.max=10

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-packaging</artifactId>
<version>20.34</version>
<version>20.50-SNAPSHOT</version>
</parent>
<properties>

View File

@@ -29,7 +29,6 @@ appender.rolling.policies.time.interval = 1
# Log4j addLoggerMBean as long as the logger exists and has been loaded.
# Hibernate
logger.hibernate.name=org.hibernate
logger.hibernate.level=error
@@ -45,42 +44,29 @@ logger.hibernate-type.level=warn
logger.hibernate-cfg-SettingsFactory.name=org.hibernate.cfg.SettingsFactory
logger.hibernate-cfg-SettingsFactory.level=warn
# Spring
logger.springframework.name=org.springframework
logger.springframework.level=warn
# Turn off Spring remoting warnings that should really be info or debug.
logger.springframework-remoting-support.name=org.springframework.remoting.support
logger.springframework-remoting-support.level=error
logger.springframework-util.name=org.springframework.util
logger.springframework-util.level=error
# Axis/WSS4J
logger.apache-axis.name=org.apache.axis
logger.apache-axis.level=info
logger.apache-ws.name=org.apache.ws
logger.apache-ws.level=info
# CXF
logger.apache-cxf.name=org.apache.cxf
logger.apache-cxf.level=error
# MyFaces
logger.apache-myfaces-util-DebugUtils.name=org.apache.myfaces.util.DebugUtils
logger.apache-myfaces-util-DebugUtils.level=info
@@ -93,17 +79,11 @@ logger.apache-myfaces-application-jsp-JspViewHandlerImpl.level=error
logger.apache-myfaces-taglib.name=org.apache.myfaces.taglib
logger.apache-myfaces-taglib.level=error
# log prepared statement cache activity ###
logger.hibernate-ps-PreparedStatementCache.name=org.hibernate.ps.PreparedStatementCache
logger.hibernate-ps-PreparedStatementCache.level=info
# Alfresco
logger.alfresco.name=org.alfresco
logger.alfresco.level=error
@@ -146,8 +126,6 @@ logger.alfresco-repo-security-sync.level=info
logger.alfresco-repo-security-person.name=org.alfresco.repo.security.person
logger.alfresco-repo-security-person.level=info
logger.alfresco-sample.name=org.alfresco.sample
logger.alfresco-sample.level=info
@@ -172,34 +150,25 @@ logger.alfresco-service-descriptor-DescriptorService.level=info
#logger.alfresco-web-page.name=org.alfresco.web.page
#logger.alfresco-web-page.level=debug
logger.alfresco-repo-importer-ImporterBootstrap.name=org.alfresco.repo.importer.ImporterBootstrap
logger.alfresco-repo-importer-ImporterBootstrap.level=error
#logger.alfresco-repo-importer-ImporterBootstrap.name=org.alfresco.repo.importer.ImporterBootstrap
#logger.alfresco-repo-importer-ImporterBootstrap.level=info
logger.alfresco-repo-admin-patch-PatchExecuter.name=org.alfresco.repo.admin.patch.PatchExecuter
logger.alfresco-repo-admin-patch-PatchExecuter.level=info
logger.alfresco-repo-domain-patch-ibatis-PatchDAOImpl.name=org.alfresco.repo.domain.patch.ibatis.PatchDAOImpl
logger.alfresco-repo-domain-patch-ibatis-PatchDAOImpl.level=info
# Specific patches
logger.alfresco-repo-admin-patch-impl-DeploymentMigrationPatch.name=org.alfresco.repo.admin.patch.impl.DeploymentMigrationPatch
logger.alfresco-repo-admin-patch-impl-DeploymentMigrationPatch.level=info
logger.alfresco-repo-version-VersionMigrator.name=org.alfresco.repo.version.VersionMigrator
logger.alfresco-repo-version-VersionMigrator.level=info
logger.alfresco-repo-module-ModuleServiceImpl.name=org.alfresco.repo.module.ModuleServiceImpl
logger.alfresco-repo-module-ModuleServiceImpl.level=info
@@ -239,74 +208,49 @@ logger.alfresco-enterprise-repo-cluster.level=info
logger.alfresco-repo-version-Version2ServiceImpl.name=org.alfresco.repo.version.Version2ServiceImpl
logger.alfresco-repo-version-Version2ServiceImpl.level=warn
#logger.alfresco-web-app-DebugPhaseListener.name=org.alfresco.web.app.DebugPhaseListener
#logger.alfresco-web-app-DebugPhaseListener.level=debug
logger.alfresco-repo-node-db-NodeStringLengthWorker.name=org.alfresco.repo.node.db.NodeStringLengthWorker
logger.alfresco-repo-node-db-NodeStringLengthWorker.level=info
logger.alfresco-repo-workflow.name=org.alfresco.repo.workflow
logger.alfresco-repo-workflow.level=info
# FTP server debugging
logger.alfresco-ftp-protocol.name=org.alfresco.ftp.protocol
logger.alfresco-ftp-protocol.level=error
#logger.alfresco-ftp-server.name=org.alfresco.ftp.server
#logger.alfresco-ftp-server.level=debug
# WebDAV debugging
#logger.alfresco-webdav-protocol.name=org.alfresco.webdav.protocol
#logger.alfresco-webdav-protocol.level=debug
logger.alfresco-webdav-protocol.name=org.alfresco.webdav.protocol
logger.alfresco-webdav-protocol.level=info
# Kerberos servlet filters
#logger.alfresco-web-app-servlet-KerberosAuthenticationFilter.name=org.alfresco.web.app.servlet.KerberosAuthenticationFilter
#logger.alfresco-web-app-servlet-KerberosAuthenticationFilter.level=debug
#logger.alfresco-repo-webdav-auth-KerberosAuthenticationFilter.name=org.alfresco.repo.webdav.auth.KerberosAuthenticationFilter
#logger.alfresco-repo-webdav-auth-KerberosAuthenticationFilter.level=debug
# File servers
logger.alfresco-fileserver.name=org.alfresco.fileserver
logger.alfresco-fileserver.level=warn
# Repo filesystem debug logging
#logger.alfresco-filesys-repo-ContentDiskDriver.name=org.alfresco.filesys.repo.ContentDiskDriver
#logger.alfresco-filesys-repo-ContentDiskDriver.level=debug
# Integrity message threshold - if 'failOnViolation' is off, then WARNINGS are generated
logger.alfresco-repo-node-integrity.name=org.alfresco.repo.node.integrity
logger.alfresco-repo-node-integrity.level=error
# Authentication
logger.alfresco-filesys-auth-ftp.name=org.alfresco.filesys.auth.ftp
logger.alfresco-filesys-auth-ftp.level=warn
@@ -323,22 +267,16 @@ logger.alfresco-web-app-servlet.name=org.alfresco.web.app.servlet
logger.alfresco-web-app-servlet.level=warn
# Used also for brute force attack detection
logger.alfresco-repo-security-authentication.name=org.alfresco.repo.security.authentication
logger.alfresco-repo-security-authentication.level=warn
# Indexer debugging
logger.alfresco-repo-search-Indexer.name=org.alfresco.repo.search.Indexer
logger.alfresco-repo-search-Indexer.level=error
#logger.alfresco-repo-search-Indexer.name=org.alfresco.repo.search.Indexer
#logger.alfresco-repo-search-Indexer.level=debug
logger.alfresco-repo-search-impl-lucene-index.name=org.alfresco.repo.search.impl.lucene.index
logger.alfresco-repo-search-impl-lucene-index.level=error
@@ -348,97 +286,62 @@ logger.alfresco-repo-search-impl-lucene-fts-FullTextSearchIndexerImpl.level=warn
#logger.alfresco-repo-search-impl-lucene-index.name=org.alfresco.repo.search.impl.lucene.index
#logger.alfresco-repo-search-impl-lucene-index.level=debug
# Audit debugging
#logger.alfresco-repo-audit.name=org.alfresco.repo.audit
#logger.alfresco-repo-audit.level=debug
#logger.alfresco-repo-audit-model.name=org.alfresco.repo.audit.model
#logger.alfresco-repo-audit-model.level=debug
# Property sheet and modelling debugging
# change to error to hide the warnings about missing properties and associations
logger.missingProperties.name=alfresco.missingProperties
logger.missingProperties.level=warn
# Dictionary/Model debugging
logger.alfresco-repo-dictionary.name=org.alfresco.repo.dictionary
logger.alfresco-repo-dictionary.level=warn
logger.alfresco-repo-dictionary-types-period.name=org.alfresco.repo.dictionary.types.period
logger.alfresco-repo-dictionary-types-period.level=warn
# Virtualization Server Registry
logger.alfresco-mbeans-VirtServerRegistry.name=org.alfresco.mbeans.VirtServerRegistry
logger.alfresco-mbeans-VirtServerRegistry.level=error
# Spring context runtime property setter
logger.alfresco-util-RuntimeSystemPropertiesSetter.name=org.alfresco.util.RuntimeSystemPropertiesSetter
logger.alfresco-util-RuntimeSystemPropertiesSetter.level=info
# Debugging options for clustering
logger.alfresco-repo-content-ReplicatingContentStore.name=org.alfresco.repo.content.ReplicatingContentStore
logger.alfresco-repo-content-ReplicatingContentStore.level=error
logger.alfresco-repo-content-replication.name=org.alfresco.repo.content.replication
logger.alfresco-repo-content-replication.level=error
#logger.alfresco-repo-deploy-DeploymentServiceImpl.name=org.alfresco.repo.deploy.DeploymentServiceImpl
#logger.alfresco-repo-deploy-DeploymentServiceImpl.level=debug
# Activity service
logger.alfresco-repo-activities.name=org.alfresco.repo.activities
logger.alfresco-repo-activities.level=warn
# User usage tracking
logger.alfresco-repo-usage.name=org.alfresco.repo.usage
logger.alfresco-repo-usage.level=info
# Sharepoint
logger.alfresco-module-vti.name=org.alfresco.module.vti
logger.alfresco-module-vti.level=info
# Forms Engine
logger.alfresco-web-config-forms.name=org.alfresco.web.config.forms
logger.alfresco-web-config-forms.level=info
logger.alfresco-web-scripts-forms.name=org.alfresco.web.scripts.forms
logger.alfresco-web-scripts-forms.level=info
# CMIS
logger.alfresco-opencmis.name=org.alfresco.opencmis
logger.alfresco-opencmis.level=error
@@ -460,35 +363,20 @@ logger.apache-chemistry-opencmis-server-impl-browser-CmisBrowserBindingServlet.l
logger.apache-chemistry-opencmis-server-impl-atompub-CmisAtomPubServlet.name=org.apache.chemistry.opencmis.server.impl.atompub.CmisAtomPubServlet
logger.apache-chemistry-opencmis-server-impl-atompub-CmisAtomPubServlet.level=off
# IMAP
logger.alfresco-repo-imap.name=org.alfresco.repo.imap
logger.alfresco-repo-imap.level=info
# JBPM
# Note: non-fatal errors (eg. logged during job execution) should be handled by Alfresco's retrying transaction handler
logger.jbpm-graph-def-GraphElement.name=org.jbpm.graph.def.GraphElement
logger.jbpm-graph-def-GraphElement.level=fatal
#logger.alfresco-repo-googledocs.name=org.alfresco.repo.googledocs
#logger.alfresco-repo-googledocs.level=debug
###### Scripting #######
# Web Framework
logger.springframework-extensions-webscripts.name=org.springframework.extensions.webscripts
logger.springframework-extensions-webscripts.level=info
@@ -498,10 +386,7 @@ logger.springframework-extensions-webscripts-ScriptLogger.level=warn
logger.springframework-extensions-webscripts-ScriptDebugger.name=org.springframework.extensions.webscripts.ScriptDebugger
logger.springframework-extensions-webscripts-ScriptDebugger.level=off
# Repository
logger.alfresco-repo-web-scripts.name=org.alfresco.repo.web.scripts
logger.alfresco-repo-web-scripts.level=warn
@@ -520,8 +405,6 @@ logger.alfresco-repo-jscript-ScriptLogger.level=warn
logger.alfresco-repo-cmis-rest-CMISTest.name=org.alfresco.repo.cmis.rest.CMISTest
logger.alfresco-repo-cmis-rest-CMISTest.level=info
logger.alfresco-repo-domain-schema-script-ScriptBundleExecutorImpl.name=org.alfresco.repo.domain.schema.script.ScriptBundleExecutorImpl
logger.alfresco-repo-domain-schema-script-ScriptBundleExecutorImpl.level=off
@@ -531,103 +414,63 @@ logger.alfresco-repo-domain-schema-script-ScriptExecutorImpl.level=info
logger.alfresco-repo-domain-schema-script-DeleteNotExistsExecutor.name=org.alfresco.repo.domain.schema.script.DeleteNotExistsExecutor
logger.alfresco-repo-domain-schema-script-DeleteNotExistsExecutor.level=off
logger.alfresco-repo-search-impl-solr-facet-SolrFacetServiceImpl.name=org.alfresco.repo.search.impl.solr.facet.SolrFacetServiceImpl
logger.alfresco-repo-search-impl-solr-facet-SolrFacetServiceImpl.level=info
# Bulk Filesystem Import Tool
logger.alfresco-repo-bulkimport.name=org.alfresco.repo.bulkimport
logger.alfresco-repo-bulkimport.level=warn
# Freemarker
# Note the freemarker.runtime logger is used to log non-fatal errors that are handled by Alfresco's retrying transaction handler
logger.runtime.name=freemarker.runtime
logger.runtime.level=
# Metadata extraction
logger.alfresco-repo-content-metadata-AbstractMappingMetadataExtracter.name=org.alfresco.repo.content.metadata.AbstractMappingMetadataExtracter
logger.alfresco-repo-content-metadata-AbstractMappingMetadataExtracter.level=warn
# no index support
logger.alfresco-repo-search-impl-noindex-NoIndexIndexer.name=org.alfresco.repo.search.impl.noindex.NoIndexIndexer
logger.alfresco-repo-search-impl-noindex-NoIndexIndexer.level=fatal
logger.alfresco-repo-search-impl-noindex-NoIndexSearchService.name=org.alfresco.repo.search.impl.noindex.NoIndexSearchService
logger.alfresco-repo-search-impl-noindex-NoIndexSearchService.level=fatal
# lucene index warnings
logger.alfresco-repo-search-impl-lucene-index-IndexInfo.name=org.alfresco.repo.search.impl.lucene.index.IndexInfo
logger.alfresco-repo-search-impl-lucene-index-IndexInfo.level=warn
# Warn about RMI socket bind retries.
logger.alfresco-util-remote-server-socket-HostConfigurableSocketFactory.name=org.alfresco.util.remote.server.socket.HostConfigurableSocketFactory
logger.alfresco-util-remote-server-socket-HostConfigurableSocketFactory.level=warn
logger.alfresco-repo-usage-RepoUsageMonitor.name=org.alfresco.repo.usage.RepoUsageMonitor
logger.alfresco-repo-usage-RepoUsageMonitor.level=info
# Authorization
logger.alfresco-enterprise-repo-authorization-AuthorizationService.name=org.alfresco.enterprise.repo.authorization.AuthorizationService
logger.alfresco-enterprise-repo-authorization-AuthorizationService.level=info
logger.alfresco-enterprise-repo-authorization-AuthorizationsConsistencyMonitor.name=org.alfresco.enterprise.repo.authorization.AuthorizationsConsistencyMonitor
logger.alfresco-enterprise-repo-authorization-AuthorizationsConsistencyMonitor.level=warn
# HeartBeat
logger.alfresco-heartbeat.name=org.alfresco.heartbeat
logger.alfresco-heartbeat.level=info
# Transformations
#logger.alfresco-repo-content-transform-TransformerDebug.name=org.alfresco.repo.content.transform.TransformerDebug
#logger.alfresco-repo-content-transform-TransformerDebug.level=debug
logger.alfresco-repo-content-transform.name=org.alfresco.repo.content.transform
logger.alfresco-repo-content-transform.level=info
# Repository probes
logger.alfresco-rest-api-probes-ProbeEntityResource.name=org.alfresco.rest.api.probes.ProbeEntityResource
logger.alfresco-rest-api-probes-ProbeEntityResource.level=info
# ActiveMQ
logger.apache-activemq-transport-failover.name=org.apache.activemq.transport.failover
logger.apache-activemq-transport-failover.level=warn
logger.apache-activemq-transport-failover.level=warn

10
pom.xml
View File

@@ -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>20.34</version>
<version>20.50-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Alfresco Community Repo Parent</name>
@@ -109,8 +109,8 @@
<dependency.jakarta-json-path.version>2.7.0</dependency.jakarta-json-path.version>
<dependency.jakarta-rpc-api.version>1.1.4</dependency.jakarta-rpc-api.version>
<alfresco.googledrive.version>3.3.1-DEV-LOG4J2</alfresco.googledrive.version>
<alfresco.aos-module.version>1.5.0-DEV-LOG4J2</alfresco.aos-module.version>
<alfresco.googledrive.version>3.4.0-A1</alfresco.googledrive.version>
<alfresco.aos-module.version>1.6.0-A1</alfresco.aos-module.version>
<alfresco.api-explorer.version>7.3.0</alfresco.api-explorer.version> <!-- Also in alfresco-enterprise-share -->
<alfresco.maven-plugin.version>2.2.0</alfresco.maven-plugin.version>
@@ -120,7 +120,7 @@
<dependency.mysql.version>8.0.30</dependency.mysql.version>
<dependency.mysql-image.version>8</dependency.mysql-image.version>
<dependency.mariadb.version>2.7.4</dependency.mariadb.version>
<dependency.tas-utility.version>3.0.56</dependency.tas-utility.version>
<dependency.tas-utility.version>3.0.57</dependency.tas-utility.version>
<dependency.rest-assured.version>5.2.0</dependency.rest-assured.version>
<dependency.tas-email.version>1.11</dependency.tas-email.version>
<dependency.tas-webdav.version>1.7</dependency.tas-webdav.version>
@@ -148,7 +148,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>20.34</tag>
<tag>HEAD</tag>
</scm>
<distributionManagement>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo</artifactId>
<version>20.34</version>
<version>20.50-SNAPSHOT</version>
</parent>
<dependencies>

View File

@@ -0,0 +1,56 @@
/*
* #%L
* Alfresco Remote API
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.rest.api;
import java.util.List;
import org.alfresco.rest.api.model.Category;
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
import org.alfresco.rest.framework.resource.parameters.Parameters;
import org.alfresco.service.Experimental;
@Experimental
public interface Categories
{
Category getCategoryById(String id, Parameters parameters);
List<Category> createSubcategories(String parentCategoryId, List<Category> categories, Parameters parameters);
CollectionWithPagingInfo<Category> getCategoryChildren(String parentCategoryId, Parameters parameters);
/**
* Update category by ID. Currently, it's possible only to update the name of category.
*
* @param id Category ID.
* @param fixedCategoryModel Fixed category model.
* @return Updated category.
*/
Category updateCategoryById(String id, Category fixedCategoryModel);
void deleteCategoryById(String id, Parameters parameters);
}

View File

@@ -0,0 +1,96 @@
/*
* #%L
* Alfresco Remote API
* %%
* 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.rest.api.categories;
import javax.servlet.http.HttpServletResponse;
import org.alfresco.rest.api.Categories;
import org.alfresco.rest.api.model.Category;
import org.alfresco.rest.framework.WebApiDescription;
import org.alfresco.rest.framework.core.exceptions.EntityNotFoundException;
import org.alfresco.rest.framework.resource.EntityResource;
import org.alfresco.rest.framework.resource.actions.interfaces.EntityResourceAction;
import org.alfresco.rest.framework.resource.parameters.Parameters;
/**
* Entity Resource for Categories
*
* @author mpichura
*/
@EntityResource(name = "categories", title = "Categories")
public class CategoriesEntityResource implements EntityResourceAction.ReadById<Category>,
EntityResourceAction.Update<Category>,
EntityResourceAction.Delete
{
private final Categories categories;
public CategoriesEntityResource(Categories categories)
{
this.categories = categories;
}
/**
* GET /categories/{categoryId}
*/
@WebApiDescription(
title = "Get category by its ID",
description = "Retrieves a category given category node id",
successStatus = HttpServletResponse.SC_OK
)
@Override
public Category readById(String id, Parameters parameters) throws EntityNotFoundException
{
return categories.getCategoryById(id, parameters);
}
/**
* PUT /categories/{categoryId}
*/
@WebApiDescription(
title = "Update category",
description = "Update a single category by its ID",
successStatus = HttpServletResponse.SC_OK
)
@Override
public Category update(String id, Category categoryModel, Parameters parameters)
{
return categories.updateCategoryById(id, categoryModel);
}
/**
* DELETE /categories/{categoryId}
*/
@WebApiDescription(
title = "Delete category",
description = "Delete a category given its node ID",
successStatus = HttpServletResponse.SC_NO_CONTENT
)
@Override
public void delete(String id, Parameters parameters)
{
categories.deleteCategoryById(id, parameters);
}
}

View File

@@ -0,0 +1,76 @@
/*
* #%L
* Alfresco Remote API
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.rest.api.categories;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.alfresco.rest.api.Categories;
import org.alfresco.rest.api.model.Category;
import org.alfresco.rest.framework.WebApiDescription;
import org.alfresco.rest.framework.resource.RelationshipResource;
import org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceAction;
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
import org.alfresco.rest.framework.resource.parameters.Parameters;
@RelationshipResource(name = "subcategories", entityResource = CategoriesEntityResource.class, title = "Subcategories")
public class SubcategoriesRelation implements RelationshipResourceAction.Create<Category>,
RelationshipResourceAction.Read<Category>
{
private final Categories categories;
public SubcategoriesRelation(Categories categories)
{
this.categories = categories;
}
/**
* POST /categories/{categoryId}/subcategories
*/
@WebApiDescription(title = "Create a category",
description = "Creates one or more categories under a parent category",
successStatus = HttpServletResponse.SC_CREATED)
@Override
public List<Category> create(String parentCategoryId, List<Category> categoryList, Parameters parameters)
{
return categories.createSubcategories(parentCategoryId, categoryList, parameters);
}
/**
* GET /categories/{categoryId}/subcategories
*/
@WebApiDescription(title = "List category direct children",
description = "Lists direct children of a parent category",
successStatus = HttpServletResponse.SC_OK)
@Override
public CollectionWithPagingInfo<Category> readAll(String parentCategoryId, Parameters params)
{
return categories.getCategoryChildren(parentCategoryId, params);
}
}

View File

@@ -0,0 +1,30 @@
/*
* #%L
* Alfresco Remote API
* %%
* Copyright (C) 2005 - 2022 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%
*/
@WebApi(name = "alfresco", scope = Api.SCOPE.PUBLIC, version = 1)
package org.alfresco.rest.api.categories;
import org.alfresco.rest.framework.Api;
import org.alfresco.rest.framework.WebApi;

View File

@@ -0,0 +1,250 @@
/*
* #%L
* Alfresco Remote API
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.rest.api.impl;
import static org.alfresco.rest.api.Nodes.PATH_ROOT;
import java.util.List;
import java.util.stream.Collectors;
import org.alfresco.model.ContentModel;
import org.alfresco.rest.api.Categories;
import org.alfresco.rest.api.Nodes;
import org.alfresco.rest.api.model.Category;
import org.alfresco.rest.api.model.Node;
import org.alfresco.rest.framework.core.exceptions.EntityNotFoundException;
import org.alfresco.rest.framework.core.exceptions.InvalidArgumentException;
import org.alfresco.rest.framework.core.exceptions.PermissionDeniedException;
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
import org.alfresco.rest.framework.resource.parameters.ListPage;
import org.alfresco.rest.framework.resource.parameters.Parameters;
import org.alfresco.service.Experimental;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.repository.StoreRef;
import org.alfresco.service.cmr.search.CategoryService;
import org.alfresco.service.cmr.security.AuthorityService;
import org.alfresco.service.namespace.QName;
import org.alfresco.service.namespace.RegexQNamePattern;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
@Experimental
public class CategoriesImpl implements Categories
{
static final String NOT_A_VALID_CATEGORY = "Node id does not refer to a valid category";
static final String NO_PERMISSION_TO_MANAGE_A_CATEGORY = "Current user does not have permission to manage a category";
static final String NOT_NULL_OR_EMPTY = "Category name must not be null or empty";
static final String FIELD_NOT_MATCH = "Category field: %s does not match the original one";
private final AuthorityService authorityService;
private final CategoryService categoryService;
private final Nodes nodes;
private final NodeService nodeService;
public CategoriesImpl(AuthorityService authorityService, CategoryService categoryService, Nodes nodes, NodeService nodeService)
{
this.authorityService = authorityService;
this.categoryService = categoryService;
this.nodes = nodes;
this.nodeService = nodeService;
}
@Override
public Category getCategoryById(final String id, final Parameters params)
{
final NodeRef nodeRef = getCategoryNodeRef(id);
if (isRootCategory(nodeRef))
{
throw new InvalidArgumentException(NOT_A_VALID_CATEGORY, new String[]{id});
}
return mapToCategory(nodeRef);
}
@Override
public List<Category> createSubcategories(String parentCategoryId, List<Category> categories, Parameters parameters)
{
verifyAdminAuthority();
final NodeRef parentNodeRef = getCategoryNodeRef(parentCategoryId);
final List<NodeRef> categoryNodeRefs = categories.stream()
.map(c -> createCategoryNodeRef(parentNodeRef, c))
.collect(Collectors.toList());
return categoryNodeRefs.stream()
.map(this::mapToCategory)
.collect(Collectors.toList());
}
@Override
public CollectionWithPagingInfo<Category> getCategoryChildren(String parentCategoryId, Parameters params)
{
final NodeRef parentNodeRef = getCategoryNodeRef(parentCategoryId);
final List<ChildAssociationRef> childCategoriesAssocs = nodeService.getChildAssocs(parentNodeRef).stream()
.filter(ca -> ContentModel.ASSOC_SUBCATEGORIES.equals(ca.getTypeQName()))
.collect(Collectors.toList());
final List<Category> categories = childCategoriesAssocs.stream()
.map(c -> mapToCategory(c.getChildRef()))
.collect(Collectors.toList());
return ListPage.of(categories, params.getPaging());
}
@Override
public Category updateCategoryById(final String id, final Category fixedCategoryModel)
{
verifyAdminAuthority();
final NodeRef categoryNodeRef = getCategoryNodeRef(id);
if (isRootCategory(categoryNodeRef))
{
throw new InvalidArgumentException(NOT_A_VALID_CATEGORY, new String[]{id});
}
verifyCategoryFields(fixedCategoryModel);
return mapToCategory(changeCategoryName(categoryNodeRef, fixedCategoryModel.getName()));
}
@Override
public void deleteCategoryById(String id, Parameters parameters)
{
verifyAdminAuthority();
final NodeRef nodeRef = getCategoryNodeRef(id);
if (isRootCategory(nodeRef))
{
throw new InvalidArgumentException(NOT_A_VALID_CATEGORY, new String[]{id});
}
nodeService.deleteNode(nodeRef);
}
private void verifyAdminAuthority()
{
if (!authorityService.hasAdminAuthority())
{
throw new PermissionDeniedException(NO_PERMISSION_TO_MANAGE_A_CATEGORY);
}
}
/**
* This method gets category NodeRef for a given category id.
* If '-root-' is passed as category id, then it's retrieved as a call to {@link org.alfresco.service.cmr.search.CategoryService#getRootCategoryNodeRef}
* In all other cases it's retrieved as a node of a category type {@link #validateCategoryNode(String)}
* @param nodeId category node id
* @return NodRef of category node
*/
private NodeRef getCategoryNodeRef(String nodeId)
{
return PATH_ROOT.equals(nodeId) ?
categoryService.getRootCategoryNodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE)
.orElseThrow(() -> new EntityNotFoundException(nodeId)) :
validateCategoryNode(nodeId);
}
/**
* Validates if the node exists and is a category.
* @param nodeId (presumably) category node id
* @return category NodeRef
*/
private NodeRef validateCategoryNode(String nodeId)
{
final NodeRef nodeRef = nodes.validateNode(nodeId);
if (isNotACategory(nodeRef))
{
throw new InvalidArgumentException(NOT_A_VALID_CATEGORY, new String[]{nodeId});
}
return nodeRef;
}
private NodeRef createCategoryNodeRef(NodeRef parentNodeRef, Category c)
{
verifyCategoryFields(c);
return categoryService.createCategory(parentNodeRef, c.getName());
}
private Category mapToCategory(NodeRef nodeRef)
{
final Node categoryNode = nodes.getNode(nodeRef.getId());
final boolean hasChildren = CollectionUtils
.isNotEmpty(nodeService.getChildAssocs(nodeRef, RegexQNamePattern.MATCH_ALL, RegexQNamePattern.MATCH_ALL, false));
return Category.builder()
.id(nodeRef.getId())
.name(categoryNode.getName())
.parentId(getParentId(nodeRef))
.hasChildren(hasChildren)
.create();
}
private boolean isNotACategory(NodeRef nodeRef)
{
return !nodes.isSubClass(nodeRef, ContentModel.TYPE_CATEGORY, false);
}
private boolean isRootCategory(final NodeRef nodeRef)
{
final List<ChildAssociationRef> parentAssocs = nodeService.getParentAssocs(nodeRef);
return parentAssocs.stream().anyMatch(pa -> ContentModel.ASPECT_GEN_CLASSIFIABLE.equals(pa.getQName()));
}
private String getParentId(final NodeRef nodeRef)
{
final NodeRef parentRef = nodeService.getPrimaryParent(nodeRef).getParentRef();
return isRootCategory(parentRef) ? PATH_ROOT : parentRef.getId();
}
/**
* Change category qualified name.
*
* @param categoryNodeRef Category node reference.
* @param newName New name.
* @return Updated category.
*/
private NodeRef changeCategoryName(final NodeRef categoryNodeRef, final String newName)
{
final ChildAssociationRef parentAssociation = nodeService.getPrimaryParent(categoryNodeRef);
if (parentAssociation == null)
{
throw new InvalidArgumentException(NOT_A_VALID_CATEGORY, new String[]{categoryNodeRef.getId()});
}
nodeService.setProperty(categoryNodeRef, ContentModel.PROP_NAME, newName);
final QName newQName = QName.createQName(parentAssociation.getQName().getNamespaceURI(), QName.createValidLocalName(newName));
return nodeService.moveNode(parentAssociation.getChildRef(), parentAssociation.getParentRef(), parentAssociation.getTypeQName(), newQName).getChildRef();
}
/**
* Verify if fixed category name is not empty.
*
* @param fixedCategoryModel Fixed category model.
*/
private void verifyCategoryFields(final Category fixedCategoryModel)
{
if (StringUtils.isEmpty(fixedCategoryModel.getName()))
{
throw new InvalidArgumentException(NOT_NULL_OR_EMPTY);
}
}
}

View File

@@ -0,0 +1,140 @@
/*
* #%L
* Alfresco Remote API
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.rest.api.model;
import java.util.Objects;
public class Category
{
private String id;
private String name;
private String parentId;
private boolean hasChildren;
public String getId()
{
return id;
}
public void setId(String id)
{
this.id = id;
}
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
public String getParentId()
{
return parentId;
}
public void setParentId(String parentId)
{
this.parentId = parentId;
}
public boolean getHasChildren()
{
return hasChildren;
}
public void setHasChildren(boolean hasChildren)
{
this.hasChildren = hasChildren;
}
@Override
public boolean equals(Object o)
{
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Category category = (Category) o;
return hasChildren == category.hasChildren && Objects.equals(id, category.id) && name.equals(category.name) &&
Objects.equals(parentId, category.parentId);
}
@Override
public int hashCode()
{
return Objects.hash(id, name, parentId, hasChildren);
}
public static Builder builder()
{
return new Builder();
}
public static class Builder
{
private String id;
private String name;
private String parentId;
private boolean hasChildren;
public Builder id(String id)
{
this.id = id;
return this;
}
public Builder name(String name)
{
this.name = name;
return this;
}
public Builder parentId(String parentId)
{
this.parentId = parentId;
return this;
}
public Builder hasChildren(boolean hasChildren)
{
this.hasChildren = hasChildren;
return this;
}
public Category create()
{
final Category category = new Category();
category.setId(id);
category.setName(name);
category.setParentId(parentId);
category.setHasChildren(hasChildren);
return category;
}
}
}

View File

@@ -44,6 +44,7 @@ import org.alfresco.rest.framework.resource.actions.interfaces.MultiPartResource
import org.alfresco.rest.framework.resource.actions.interfaces.MultiPartRelationshipResourceAction;
import org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceAction;
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
import org.alfresco.rest.framework.resource.parameters.Paging;
import org.alfresco.rest.framework.resource.parameters.Params;
import org.alfresco.rest.framework.resource.parameters.Params.RecognizedParams;
import org.alfresco.rest.framework.tools.RecognizedParamsExtractor;
@@ -377,7 +378,8 @@ public class ResourceWebScriptPost extends AbstractResourceWebScript implements
{
if (created !=null && created.size() > 1)
{
return CollectionWithPagingInfo.asPagedCollection(created.toArray());
final Paging pagingAll = Paging.valueOf(0, created.size());
return CollectionWithPagingInfo.asPaged(pagingAll, created);
}
else
{

View File

@@ -828,7 +828,28 @@
</list>
</property>
</bean>
<bean id="categories" class="org.alfresco.rest.api.impl.CategoriesImpl">
<constructor-arg name="authorityService" ref="AuthorityService"/>
<constructor-arg name="categoryService" ref="CategoryService"/>
<constructor-arg name="nodes" ref="nodes"/>
<constructor-arg name="nodeService" ref="NodeService"/>
</bean>
<bean id="Categories" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces">
<value>org.alfresco.rest.api.Categories</value>
</property>
<property name="target">
<ref bean="categories"/>
</property>
<property name="interceptorNames">
<list>
<idref bean="legacyExceptionInterceptor"/>
</list>
</property>
</bean>
<bean id="tags" class="org.alfresco.rest.api.impl.TagsImpl">
<property name="nodes" ref="nodes" />
<property name="taggingService" ref="TaggingService" />
@@ -1075,7 +1096,15 @@
<bean class="org.alfresco.rest.api.people.PersonGroupsRelation">
<property name="groups" ref="Groups" />
</bean>
<bean class="org.alfresco.rest.api.categories.CategoriesEntityResource">
<constructor-arg name="categories" ref="Categories"/>
</bean>
<bean class="org.alfresco.rest.api.categories.SubcategoriesRelation">
<constructor-arg name="categories" ref="Categories"/>
</bean>
<bean class="org.alfresco.rest.api.tags.TagsEntityResource">
<property name="tags" ref="Tags" />
</bean>

View File

@@ -0,0 +1,83 @@
/*
* #%L
* Alfresco Remote API
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.rest.api.categories;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.given;
import static org.mockito.BDDMockito.then;
import org.alfresco.rest.api.Categories;
import org.alfresco.rest.api.model.Category;
import org.alfresco.rest.framework.resource.parameters.Parameters;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
public class CategoriesEntityResourceTest
{
private static final String CATEGORY_ID = "category-node-id";
@Mock
private Categories categoriesMock;
@Mock
private Category categoryMock;
@Mock
private Parameters parametersMock;
@InjectMocks
private CategoriesEntityResource objectUnderTest;
@Test
public void testReadCategoryById()
{
given(categoriesMock.getCategoryById(CATEGORY_ID, parametersMock)).willReturn(categoryMock);
//when
final Category category = objectUnderTest.readById(CATEGORY_ID, parametersMock);
then(categoriesMock).should().getCategoryById(CATEGORY_ID, parametersMock);
then(categoriesMock).shouldHaveNoMoreInteractions();
assertEquals(categoryMock, category);
}
@Test
public void testUpdateCategoryById()
{
given(categoriesMock.updateCategoryById(any(), any())).willReturn(categoryMock);
// when
final Category actualCategory = objectUnderTest.update(CATEGORY_ID, categoryMock, parametersMock);
then(categoriesMock).should().updateCategoryById(CATEGORY_ID, categoryMock);
then(categoriesMock).shouldHaveNoMoreInteractions();
assertThat(actualCategory).isNotNull();
}
}

View File

@@ -0,0 +1,105 @@
/*
* #%L
* Alfresco Remote API
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.rest.api.categories;
import static org.junit.Assert.assertEquals;
import static org.mockito.BDDMockito.given;
import static org.mockito.BDDMockito.then;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import org.alfresco.rest.api.Categories;
import org.alfresco.rest.api.model.Category;
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
import org.alfresco.rest.framework.resource.parameters.Paging;
import org.alfresco.rest.framework.resource.parameters.Parameters;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
public class SubcategoriesRelationTest
{
private static final String PARENT_CATEGORY_ID = "parent-category-node-id";
private static final String CATEGORY_ID = "category-node-id";
private static final String CATEGORY_NAME = "categoryName";
private static final String SUBCATEGORY_NAME_PREFIX = "childCategoryName";
@Mock
private Categories categoriesMock;
@Mock
private Parameters parametersMock;
@InjectMocks
private SubcategoriesRelation objectUnderTest;
@Test
public void testCreateSubcategory()
{
final Category categoryToCreate = Category.builder().name(CATEGORY_NAME).create();
final Category category = Category.builder().name(CATEGORY_NAME).parentId(PARENT_CATEGORY_ID).hasChildren(false).id(CATEGORY_ID).create();
final List<Category> categoriesToCreate = List.of(categoryToCreate);
given(categoriesMock.createSubcategories(PARENT_CATEGORY_ID, categoriesToCreate, parametersMock)).willReturn(List.of(category));
//when
List<Category> categories = objectUnderTest.create(PARENT_CATEGORY_ID, categoriesToCreate, parametersMock);
then(categoriesMock).should().createSubcategories(PARENT_CATEGORY_ID, categoriesToCreate, parametersMock);
then(categoriesMock).shouldHaveNoMoreInteractions();
assertEquals(List.of(category), categories);
}
@Test
public void testGetCategoryChildren() {
final CollectionWithPagingInfo<Category> categoryChildren = getCategories(3);
given(categoriesMock.getCategoryChildren(PARENT_CATEGORY_ID, parametersMock)).willReturn(categoryChildren);
//when
final CollectionWithPagingInfo<Category> returnedChildren = objectUnderTest.readAll(PARENT_CATEGORY_ID, parametersMock);
then(categoriesMock).should().getCategoryChildren(PARENT_CATEGORY_ID, parametersMock);
then(categoriesMock).shouldHaveNoMoreInteractions();
assertEquals(categoryChildren, returnedChildren);
}
private CollectionWithPagingInfo<Category> getCategories(final int count)
{
return CollectionWithPagingInfo.asPaged(Paging.DEFAULT,
IntStream.range(0, count)
.mapToObj(i -> Category.builder().name(SUBCATEGORY_NAME_PREFIX + "-" + i)
.parentId(PARENT_CATEGORY_ID)
.hasChildren(false)
.id(CATEGORY_ID + "-" + i)
.create())
.collect(Collectors.toList())
);
}
}

View File

@@ -0,0 +1,868 @@
/*
* #%L
* Alfresco Remote API
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.rest.api.impl;
import static org.alfresco.rest.api.Nodes.PATH_ROOT;
import static org.alfresco.rest.api.impl.CategoriesImpl.NOT_A_VALID_CATEGORY;
import static org.alfresco.rest.api.impl.CategoriesImpl.NOT_NULL_OR_EMPTY;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThrows;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.BDDMockito.given;
import static org.mockito.BDDMockito.then;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import org.alfresco.model.ContentModel;
import org.alfresco.rest.api.Nodes;
import org.alfresco.rest.api.model.Category;
import org.alfresco.rest.api.model.Node;
import org.alfresco.rest.framework.core.exceptions.EntityNotFoundException;
import org.alfresco.rest.framework.core.exceptions.InvalidArgumentException;
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.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.repository.StoreRef;
import org.alfresco.service.cmr.search.CategoryService;
import org.alfresco.service.cmr.security.AuthorityService;
import org.alfresco.service.namespace.QName;
import org.alfresco.service.namespace.RegexQNamePattern;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
public class CategoriesImplTest
{
private static final String CATEGORY_ID = "category-node-id";
private static final String CATEGORY_NAME = "categoryName";
private static final String PARENT_ID = "parent-node-id";
private static final String CAT_ROOT_NODE_ID = "cat-root-node-id";
private static final NodeRef CATEGORY_NODE_REF = createNodeRefWithId(CATEGORY_ID);
private static final Category CATEGORY = createDefaultCategoryWithName(CATEGORY_NAME);
@Mock
private Nodes nodesMock;
@Mock
private NodeService nodeServiceMock;
@Mock
private Parameters parametersMock;
@Mock
private AuthorityService authorityServiceMock;
@Mock
private CategoryService categoryServiceMock;
@Mock
private ChildAssociationRef dummyChildAssociationRefMock;
@Mock
private ChildAssociationRef categoryChildAssociationRefMock;
@InjectMocks
private CategoriesImpl objectUnderTest;
@Before
public void setUp() throws Exception
{
given(authorityServiceMock.hasAdminAuthority()).willReturn(true);
given(nodesMock.validateNode(eq(CATEGORY_ID))).willReturn(CATEGORY_NODE_REF);
given(nodesMock.isSubClass(any(), any(), anyBoolean())).willReturn(true);
}
@Test
public void shouldNotGetRootCategoryById()
{
final NodeRef categoryRootNodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, CAT_ROOT_NODE_ID);
given(nodesMock.validateNode(CAT_ROOT_NODE_ID)).willReturn(categoryRootNodeRef);
given(categoryChildAssociationRefMock.getQName()).willReturn(ContentModel.ASPECT_GEN_CLASSIFIABLE);
given(nodeServiceMock.getParentAssocs(categoryRootNodeRef)).willReturn(List.of(categoryChildAssociationRefMock));
//when
assertThrows(InvalidArgumentException.class, () -> objectUnderTest.getCategoryById(CAT_ROOT_NODE_ID, parametersMock));
then(nodesMock).should().validateNode(CAT_ROOT_NODE_ID);
then(nodesMock).should().isSubClass(categoryRootNodeRef, ContentModel.TYPE_CATEGORY, false);
then(nodesMock).shouldHaveNoMoreInteractions();
then(nodeServiceMock).should().getParentAssocs(categoryRootNodeRef);
then(nodeServiceMock).shouldHaveNoMoreInteractions();
then(categoryServiceMock).shouldHaveNoInteractions();
then(authorityServiceMock).shouldHaveNoInteractions();
}
@Test
public void testGetCategoryById_withChildren()
{
final NodeRef categoryNodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, CATEGORY_ID);
given(nodesMock.validateNode(CATEGORY_ID)).willReturn(categoryNodeRef);
final Node categoryNode = new Node();
categoryNode.setName(CATEGORY_NAME);
categoryNode.setNodeId(CATEGORY_ID);
final NodeRef parentNodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, PARENT_ID);
categoryNode.setParentId(parentNodeRef);
given(nodesMock.getNode(CATEGORY_ID)).willReturn(categoryNode);
final ChildAssociationRef parentAssoc = new ChildAssociationRef(null, parentNodeRef, null, categoryNodeRef);
given(nodeServiceMock.getPrimaryParent(categoryNodeRef)).willReturn(parentAssoc);
final List<ChildAssociationRef> dummyChildren = List.of(dummyChildAssociationRefMock);
given(nodeServiceMock.getChildAssocs(categoryNodeRef, RegexQNamePattern.MATCH_ALL, RegexQNamePattern.MATCH_ALL, false))
.willReturn(dummyChildren);
//when
final Category category = objectUnderTest.getCategoryById(CATEGORY_ID, parametersMock);
then(nodesMock).should().validateNode(CATEGORY_ID);
then(nodesMock).should().isSubClass(categoryNodeRef, ContentModel.TYPE_CATEGORY, false);
then(nodesMock).should().getNode(CATEGORY_ID);
then(nodesMock).shouldHaveNoMoreInteractions();
then(nodeServiceMock).should().getPrimaryParent(categoryNodeRef);
then(nodeServiceMock).should().getParentAssocs(parentNodeRef);
then(nodeServiceMock).should().getParentAssocs(categoryNodeRef);
then(nodeServiceMock).should().getChildAssocs(categoryNodeRef, RegexQNamePattern.MATCH_ALL, RegexQNamePattern.MATCH_ALL, false);
then(nodeServiceMock).shouldHaveNoMoreInteractions();
then(categoryServiceMock).shouldHaveNoInteractions();
then(authorityServiceMock).shouldHaveNoInteractions();
final Category expectedCategory = Category.builder()
.id(CATEGORY_ID)
.name(categoryNode.getName())
.hasChildren(true)
.parentId(PARENT_ID)
.create();
assertEquals(expectedCategory, category);
}
@Test
public void testGetCategoryById_withoutChildren()
{
final NodeRef categoryNodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, CATEGORY_ID);
given(nodesMock.validateNode(CATEGORY_ID)).willReturn(categoryNodeRef);
final Node categoryNode = new Node();
categoryNode.setName(CATEGORY_NAME);
categoryNode.setNodeId(CATEGORY_ID);
final NodeRef parentNodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, PARENT_ID);
categoryNode.setParentId(parentNodeRef);
given(nodesMock.getNode(CATEGORY_ID)).willReturn(categoryNode);
final ChildAssociationRef parentAssoc = new ChildAssociationRef(null, parentNodeRef, null, categoryNodeRef);
given(nodeServiceMock.getPrimaryParent(categoryNodeRef)).willReturn(parentAssoc);
given(nodeServiceMock.getChildAssocs(categoryNodeRef, RegexQNamePattern.MATCH_ALL, RegexQNamePattern.MATCH_ALL, false))
.willReturn(Collections.emptyList());
//when
final Category category = objectUnderTest.getCategoryById(CATEGORY_ID, parametersMock);
then(nodesMock).should().validateNode(CATEGORY_ID);
then(nodesMock).should().isSubClass(categoryNodeRef, ContentModel.TYPE_CATEGORY, false);
then(nodesMock).should().getNode(CATEGORY_ID);
then(nodesMock).shouldHaveNoMoreInteractions();
then(nodeServiceMock).should().getPrimaryParent(categoryNodeRef);
then(nodeServiceMock).should().getParentAssocs(parentNodeRef);
then(nodeServiceMock).should().getParentAssocs(categoryNodeRef);
then(nodeServiceMock).should().getChildAssocs(categoryNodeRef, RegexQNamePattern.MATCH_ALL, RegexQNamePattern.MATCH_ALL, false);
then(nodeServiceMock).shouldHaveNoMoreInteractions();
then(categoryServiceMock).shouldHaveNoInteractions();
then(authorityServiceMock).shouldHaveNoInteractions();
final Category expectedCategory = Category.builder()
.id(CATEGORY_ID)
.name(categoryNode.getName())
.hasChildren(false)
.parentId(PARENT_ID)
.create();
assertEquals(expectedCategory, category);
}
@Test
public void testGetCategoryById_notACategory()
{
final NodeRef categoryNodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, CATEGORY_ID);
given(nodesMock.validateNode(CATEGORY_ID)).willReturn(categoryNodeRef);
given(nodesMock.isSubClass(categoryNodeRef, ContentModel.TYPE_CATEGORY, false)).willReturn(false);
//when
assertThrows(InvalidArgumentException.class, () -> objectUnderTest.getCategoryById(CATEGORY_ID, parametersMock));
then(nodesMock).should().validateNode(CATEGORY_ID);
then(nodesMock).should().isSubClass(categoryNodeRef, ContentModel.TYPE_CATEGORY, false);
then(nodesMock).shouldHaveNoMoreInteractions();
then(nodeServiceMock).shouldHaveNoInteractions();
then(categoryServiceMock).shouldHaveNoInteractions();
then(authorityServiceMock).shouldHaveNoInteractions();
}
@Test
public void testGetCategoryById_nodeNotExists()
{
given(nodesMock.validateNode(CATEGORY_ID)).willThrow(EntityNotFoundException.class);
//when
assertThrows(EntityNotFoundException.class, () -> objectUnderTest.getCategoryById(CATEGORY_ID, parametersMock));
then(nodesMock).should().validateNode(CATEGORY_ID);
then(nodesMock).shouldHaveNoMoreInteractions();
then(nodeServiceMock).shouldHaveNoInteractions();
then(categoryServiceMock).shouldHaveNoInteractions();
then(authorityServiceMock).shouldHaveNoInteractions();
}
@Test
public void testDeleteCategoryById_asAdmin()
{
given(authorityServiceMock.hasAdminAuthority()).willReturn(true);
final NodeRef categoryNodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, CATEGORY_ID);
given(nodesMock.validateNode(CATEGORY_ID)).willReturn(categoryNodeRef);
given(nodesMock.isSubClass(categoryNodeRef, ContentModel.TYPE_CATEGORY, false)).willReturn(true);
final Node categoryNode = new Node();
categoryNode.setName(CATEGORY_NAME);
categoryNode.setNodeId(CATEGORY_ID);
final NodeRef parentNodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, PARENT_ID);
categoryNode.setParentId(parentNodeRef);
//when
objectUnderTest.deleteCategoryById(CATEGORY_ID, parametersMock);
then(authorityServiceMock).should().hasAdminAuthority();
then(authorityServiceMock).shouldHaveNoMoreInteractions();
then(nodesMock).should().validateNode(CATEGORY_ID);
then(nodesMock).should().isSubClass(categoryNodeRef, ContentModel.TYPE_CATEGORY, false);
then(nodesMock).shouldHaveNoMoreInteractions();
then(nodeServiceMock).should().getParentAssocs(categoryNodeRef);
then(nodeServiceMock).should().deleteNode(categoryNodeRef);
then(nodeServiceMock).shouldHaveNoMoreInteractions();
}
@Test
public void testDeleteCategoryById_asNonAdminUser()
{
given(authorityServiceMock.hasAdminAuthority()).willReturn(false);
//when
assertThrows(PermissionDeniedException.class, () -> objectUnderTest.deleteCategoryById(CATEGORY_ID, parametersMock));
then(authorityServiceMock).should().hasAdminAuthority();
then(authorityServiceMock).shouldHaveNoMoreInteractions();
then(nodesMock).shouldHaveNoInteractions();
then(nodeServiceMock).shouldHaveNoInteractions();
}
@Test
public void testDeleteCategoryById_nonCategoryId()
{
given(authorityServiceMock.hasAdminAuthority()).willReturn(true);
final NodeRef categoryNodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, CATEGORY_ID);
given(nodesMock.validateNode(CATEGORY_ID)).willReturn(categoryNodeRef);
given(nodesMock.isSubClass(categoryNodeRef, ContentModel.TYPE_CATEGORY, false)).willReturn(false);
//when
assertThrows(InvalidArgumentException.class, () -> objectUnderTest.deleteCategoryById(CATEGORY_ID, parametersMock));
then(authorityServiceMock).should().hasAdminAuthority();
then(authorityServiceMock).shouldHaveNoMoreInteractions();
then(nodesMock).should().validateNode(CATEGORY_ID);
then(nodesMock).should().isSubClass(categoryNodeRef, ContentModel.TYPE_CATEGORY, false);
then(nodesMock).shouldHaveNoMoreInteractions();
}
@Test
public void testDeleteCategoryById_rootCategory()
{
given(authorityServiceMock.hasAdminAuthority()).willReturn(true);
final NodeRef categoryRootNodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, CAT_ROOT_NODE_ID);
given(nodesMock.validateNode(CAT_ROOT_NODE_ID)).willReturn(categoryRootNodeRef);
given(nodesMock.isSubClass(categoryRootNodeRef, ContentModel.TYPE_CATEGORY, false)).willReturn(true);
given(categoryChildAssociationRefMock.getQName()).willReturn(ContentModel.ASPECT_GEN_CLASSIFIABLE);
given(nodeServiceMock.getParentAssocs(categoryRootNodeRef)).willReturn(List.of(categoryChildAssociationRefMock));
//when
assertThrows(InvalidArgumentException.class, () -> objectUnderTest.deleteCategoryById(CAT_ROOT_NODE_ID, parametersMock));
then(authorityServiceMock).should().hasAdminAuthority();
then(authorityServiceMock).shouldHaveNoMoreInteractions();
then(nodesMock).should().validateNode(CAT_ROOT_NODE_ID);
then(nodesMock).should().isSubClass(categoryRootNodeRef, ContentModel.TYPE_CATEGORY, false);
then(nodesMock).shouldHaveNoMoreInteractions();
then(nodeServiceMock).should().getParentAssocs(categoryRootNodeRef);
then(nodeServiceMock).shouldHaveNoMoreInteractions();
}
@Test
public void testCreateCategoryUnderRoot()
{
final NodeRef parentCategoryNodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, PATH_ROOT);
given(categoryServiceMock.getRootCategoryNodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE))
.willReturn(Optional.of(parentCategoryNodeRef));
final NodeRef categoryNodeRef = createNodeRefWithId(CATEGORY_ID);
given(categoryServiceMock.createCategory(parentCategoryNodeRef, CATEGORY_NAME)).willReturn(categoryNodeRef);
given(nodesMock.getNode(CATEGORY_ID)).willReturn(prepareCategoryNode());
final ChildAssociationRef parentAssoc = new ChildAssociationRef(null, parentCategoryNodeRef, null, categoryNodeRef);
given(nodeServiceMock.getPrimaryParent(categoryNodeRef)).willReturn(parentAssoc);
given(nodeServiceMock.getParentAssocs(parentCategoryNodeRef)).willReturn(List.of(parentAssoc));
given(nodeServiceMock.getChildAssocs(categoryNodeRef, RegexQNamePattern.MATCH_ALL, RegexQNamePattern.MATCH_ALL, false))
.willReturn(Collections.emptyList());
//when
final List<Category> createdCategories = objectUnderTest.createSubcategories(PATH_ROOT, prepareCategories(), parametersMock);
then(authorityServiceMock).should().hasAdminAuthority();
then(authorityServiceMock).shouldHaveNoMoreInteractions();
then(nodesMock).should().getNode(CATEGORY_ID);
then(nodesMock).shouldHaveNoMoreInteractions();
then(nodeServiceMock).should().getPrimaryParent(categoryNodeRef);
then(nodeServiceMock).should().getParentAssocs(parentCategoryNodeRef);
then(nodeServiceMock).should().getChildAssocs(categoryNodeRef, RegexQNamePattern.MATCH_ALL, RegexQNamePattern.MATCH_ALL, false);
then(nodeServiceMock).shouldHaveNoMoreInteractions();
then(categoryServiceMock).should().getRootCategoryNodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
then(categoryServiceMock).should().createCategory(parentCategoryNodeRef, CATEGORY_NAME);
then(categoryServiceMock).shouldHaveNoMoreInteractions();
assertEquals(1, createdCategories.size());
final Category expectedCategory = Category.builder()
.id(CATEGORY_ID)
.name(CATEGORY_NAME)
.hasChildren(false)
.parentId(PATH_ROOT)
.create();
final Category createdCategory = createdCategories.iterator().next();
assertEquals(expectedCategory, createdCategory);
}
@Test
public void testCreateCategory()
{
final NodeRef parentCategoryNodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, PARENT_ID);
given(nodesMock.validateNode(PARENT_ID)).willReturn(parentCategoryNodeRef);
final NodeRef categoryNodeRef = createNodeRefWithId(CATEGORY_ID);
given(categoryServiceMock.createCategory(parentCategoryNodeRef, CATEGORY_NAME)).willReturn(categoryNodeRef);
given(nodesMock.getNode(CATEGORY_ID)).willReturn(prepareCategoryNode());
final ChildAssociationRef parentAssoc = new ChildAssociationRef(null, parentCategoryNodeRef, null, categoryNodeRef);
given(nodeServiceMock.getPrimaryParent(categoryNodeRef)).willReturn(parentAssoc);
given(nodeServiceMock.getParentAssocs(parentCategoryNodeRef)).willReturn(List.of(parentAssoc));
given(nodeServiceMock.getChildAssocs(categoryNodeRef, RegexQNamePattern.MATCH_ALL, RegexQNamePattern.MATCH_ALL, false))
.willReturn(Collections.emptyList());
//when
final List<Category> createdCategories = objectUnderTest.createSubcategories(PARENT_ID, prepareCategories(), parametersMock);
then(authorityServiceMock).should().hasAdminAuthority();
then(authorityServiceMock).shouldHaveNoMoreInteractions();
then(nodesMock).should().validateNode(PARENT_ID);
then(nodesMock).should().isSubClass(parentCategoryNodeRef, ContentModel.TYPE_CATEGORY, false);
then(nodesMock).should().getNode(CATEGORY_ID);
then(nodesMock).shouldHaveNoMoreInteractions();
then(nodeServiceMock).should().getPrimaryParent(categoryNodeRef);
then(nodeServiceMock).should().getParentAssocs(parentCategoryNodeRef);
then(nodeServiceMock).should().getChildAssocs(categoryNodeRef, RegexQNamePattern.MATCH_ALL, RegexQNamePattern.MATCH_ALL, false);
then(nodeServiceMock).shouldHaveNoMoreInteractions();
then(categoryServiceMock).should().createCategory(parentCategoryNodeRef, CATEGORY_NAME);
then(categoryServiceMock).shouldHaveNoMoreInteractions();
assertEquals(1, createdCategories.size());
final Category expectedCategory = Category.builder()
.id(CATEGORY_ID)
.name(CATEGORY_NAME)
.hasChildren(false)
.parentId(PARENT_ID)
.create();
final Category createdCategory = createdCategories.iterator().next();
assertEquals(expectedCategory, createdCategory);
}
@Test
public void testCreateCategories_noPermissions()
{
given(authorityServiceMock.hasAdminAuthority()).willReturn(false);
//when
assertThrows(PermissionDeniedException.class,
() -> objectUnderTest.createSubcategories(PARENT_ID, prepareCategories(), parametersMock));
then(authorityServiceMock).should().hasAdminAuthority();
then(authorityServiceMock).shouldHaveNoMoreInteractions();
then(nodesMock).shouldHaveNoInteractions();
then(nodeServiceMock).shouldHaveNoInteractions();
then(categoryServiceMock).shouldHaveNoInteractions();
}
@Test
public void testCreateCategories_wrongParentNodeType()
{
final NodeRef parentCategoryNodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, PARENT_ID);
given(nodesMock.validateNode(PARENT_ID)).willReturn(parentCategoryNodeRef);
given(nodesMock.isSubClass(parentCategoryNodeRef, ContentModel.TYPE_CATEGORY, false)).willReturn(false);
//when
assertThrows(InvalidArgumentException.class,
() -> objectUnderTest.createSubcategories(PARENT_ID, prepareCategories(), parametersMock));
then(authorityServiceMock).should().hasAdminAuthority();
then(authorityServiceMock).shouldHaveNoMoreInteractions();
then(nodesMock).should().validateNode(PARENT_ID);
then(nodesMock).should().isSubClass(parentCategoryNodeRef, ContentModel.TYPE_CATEGORY, false);
then(nodesMock).shouldHaveNoMoreInteractions();
then(nodeServiceMock).shouldHaveNoInteractions();
then(categoryServiceMock).shouldHaveNoInteractions();
}
@Test
public void testCreateCategories_nonExistingParentNode()
{
given(nodesMock.validateNode(PARENT_ID)).willThrow(EntityNotFoundException.class);
//when
assertThrows(EntityNotFoundException.class,
() -> objectUnderTest.createSubcategories(PARENT_ID, prepareCategories(), parametersMock));
then(authorityServiceMock).should().hasAdminAuthority();
then(authorityServiceMock).shouldHaveNoMoreInteractions();
then(nodesMock).should().validateNode(PARENT_ID);
then(nodesMock).shouldHaveNoMoreInteractions();
then(nodeServiceMock).shouldHaveNoInteractions();
then(categoryServiceMock).shouldHaveNoInteractions();
}
@Test
public void testGetRootCategoryChildren()
{
final NodeRef parentCategoryNodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, PATH_ROOT);
given(categoryServiceMock.getRootCategoryNodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE))
.willReturn(Optional.of(parentCategoryNodeRef));
final int childrenCount = 3;
final List<ChildAssociationRef> childAssociationRefMocks = prepareChildAssocMocks(childrenCount, parentCategoryNodeRef);
given(nodeServiceMock.getChildAssocs(parentCategoryNodeRef)).willReturn(childAssociationRefMocks);
childAssociationRefMocks.forEach(this::prepareCategoryNodeMocks);
//when
final CollectionWithPagingInfo<Category> categoryChildren = objectUnderTest.getCategoryChildren(PATH_ROOT, parametersMock);
then(categoryServiceMock).should().getRootCategoryNodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
then(categoryServiceMock).shouldHaveNoMoreInteractions();
then(nodeServiceMock).should().getChildAssocs(parentCategoryNodeRef);
childAssociationRefMocks.forEach(ca -> {
then(nodesMock).should().getNode(ca.getChildRef().getId());
then(nodeServiceMock).should()
.getChildAssocs(ca.getChildRef(), RegexQNamePattern.MATCH_ALL, RegexQNamePattern.MATCH_ALL, false);
then(nodeServiceMock).should().getPrimaryParent(ca.getChildRef());
});
then(nodeServiceMock).should(times(childrenCount)).getParentAssocs(parentCategoryNodeRef);
then(nodesMock).shouldHaveNoMoreInteractions();
then(nodeServiceMock).shouldHaveNoMoreInteractions();
then(authorityServiceMock).shouldHaveNoInteractions();
assertEquals(childAssociationRefMocks.size(), categoryChildren.getTotalItems().intValue());
final List<Category> categoryChildrenList = new ArrayList<>(categoryChildren.getCollection());
assertEquals(childAssociationRefMocks.size(), categoryChildrenList.size());
IntStream.range(0, childrenCount).forEach(i -> doCategoryAssertions(categoryChildrenList.get(i), i, PATH_ROOT));
}
@Test
public void testGetCategoryChildren()
{
final NodeRef parentCategoryNodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, PARENT_ID);
given(nodesMock.validateNode(PARENT_ID)).willReturn(parentCategoryNodeRef);
given(nodesMock.isSubClass(parentCategoryNodeRef, ContentModel.TYPE_CATEGORY, false)).willReturn(true);
final int childrenCount = 3;
final List<ChildAssociationRef> childAssociationRefMocks = prepareChildAssocMocks(childrenCount, parentCategoryNodeRef);
given(nodeServiceMock.getChildAssocs(parentCategoryNodeRef)).willReturn(childAssociationRefMocks);
childAssociationRefMocks.forEach(this::prepareCategoryNodeMocks);
//when
final CollectionWithPagingInfo<Category> categoryChildren = objectUnderTest.getCategoryChildren(PARENT_ID, parametersMock);
then(nodesMock).should().validateNode(PARENT_ID);
then(nodesMock).should().isSubClass(parentCategoryNodeRef, ContentModel.TYPE_CATEGORY, false);
then(nodeServiceMock).should().getChildAssocs(parentCategoryNodeRef);
childAssociationRefMocks.forEach(ca -> {
then(nodesMock).should().getNode(ca.getChildRef().getId());
then(nodeServiceMock).should()
.getChildAssocs(ca.getChildRef(), RegexQNamePattern.MATCH_ALL, RegexQNamePattern.MATCH_ALL, false);
then(nodeServiceMock).should().getPrimaryParent(ca.getChildRef());
});
then(nodeServiceMock).should(times(childrenCount)).getParentAssocs(parentCategoryNodeRef);
then(nodesMock).shouldHaveNoMoreInteractions();
then(nodeServiceMock).shouldHaveNoMoreInteractions();
then(authorityServiceMock).shouldHaveNoInteractions();
then(categoryServiceMock).shouldHaveNoInteractions();
assertEquals(childAssociationRefMocks.size(), categoryChildren.getTotalItems().intValue());
final List<Category> categoryChildrenList = new ArrayList<>(categoryChildren.getCollection());
assertEquals(childAssociationRefMocks.size(), categoryChildrenList.size());
IntStream.range(0, childrenCount).forEach(i -> doCategoryAssertions(categoryChildrenList.get(i), i, PARENT_ID));
}
@Test
public void testGetCategoryChildren_noChildren()
{
final NodeRef parentCategoryNodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, PARENT_ID);
given(nodesMock.validateNode(PARENT_ID)).willReturn(parentCategoryNodeRef);
given(nodesMock.isSubClass(parentCategoryNodeRef, ContentModel.TYPE_CATEGORY, false)).willReturn(true);
given(nodeServiceMock.getChildAssocs(parentCategoryNodeRef)).willReturn(Collections.emptyList());
//when
final CollectionWithPagingInfo<Category> categoryChildren = objectUnderTest.getCategoryChildren(PARENT_ID, parametersMock);
then(nodesMock).should().validateNode(PARENT_ID);
then(nodesMock).should().isSubClass(parentCategoryNodeRef, ContentModel.TYPE_CATEGORY, false);
then(nodesMock).shouldHaveNoMoreInteractions();
then(nodeServiceMock).should().getChildAssocs(parentCategoryNodeRef);
then(nodeServiceMock).shouldHaveNoMoreInteractions();
then(authorityServiceMock).shouldHaveNoInteractions();
then(categoryServiceMock).shouldHaveNoInteractions();
assertEquals(0, categoryChildren.getTotalItems().intValue());
}
@Test
public void testGetCategoryChildren_wrongParentNodeType()
{
final NodeRef parentCategoryNodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, PARENT_ID);
given(nodesMock.validateNode(PARENT_ID)).willReturn(parentCategoryNodeRef);
given(nodesMock.isSubClass(parentCategoryNodeRef, ContentModel.TYPE_CATEGORY, false)).willReturn(false);
//when
assertThrows(InvalidArgumentException.class, () -> objectUnderTest.getCategoryChildren(PARENT_ID, parametersMock));
then(nodesMock).should().validateNode(PARENT_ID);
then(nodesMock).should().isSubClass(parentCategoryNodeRef, ContentModel.TYPE_CATEGORY, false);
then(nodesMock).shouldHaveNoMoreInteractions();
then(nodeServiceMock).shouldHaveNoInteractions();
then(categoryServiceMock).shouldHaveNoInteractions();
then(authorityServiceMock).shouldHaveNoInteractions();
}
@Test
public void testGetCategoryChildren_nonExistingParentNode()
{
given(nodesMock.validateNode(PARENT_ID)).willThrow(EntityNotFoundException.class);
//when
assertThrows(EntityNotFoundException.class, () -> objectUnderTest.getCategoryChildren(PARENT_ID, parametersMock));
then(nodesMock).should().validateNode(PARENT_ID);
then(nodesMock).shouldHaveNoMoreInteractions();
then(nodeServiceMock).shouldHaveNoInteractions();
then(categoryServiceMock).shouldHaveNoInteractions();
then(authorityServiceMock).shouldHaveNoInteractions();
}
@Test
public void testUpdateCategoryById()
{
final String categoryNewName = "categoryNewName";
final Category fixedCategory = createCategoryOnlyWithName(categoryNewName);
final QName categoryQName = createCmQNameOf(CATEGORY_NAME);
final NodeRef parentCategoryNodeRef = createNodeRefWithId(PARENT_ID);
final ChildAssociationRef parentAssociation = createAssociationOf(parentCategoryNodeRef, CATEGORY_NODE_REF, categoryQName);
given(nodesMock.getNode(any())).willReturn(prepareCategoryNode(categoryNewName));
given(nodeServiceMock.getPrimaryParent(any())).willReturn(parentAssociation);
given(nodeServiceMock.moveNode(any(), any(), any(), any())).willReturn(createAssociationOf(parentCategoryNodeRef, CATEGORY_NODE_REF, createCmQNameOf(categoryNewName)));
// when
final Category actualCategory = objectUnderTest.updateCategoryById(CATEGORY_ID, fixedCategory);
then(authorityServiceMock).should().hasAdminAuthority();
then(authorityServiceMock).shouldHaveNoMoreInteractions();
then(nodesMock).should().validateNode(CATEGORY_ID);
then(nodesMock).should().isSubClass(CATEGORY_NODE_REF, ContentModel.TYPE_CATEGORY, false);
then(nodesMock).should().getNode(CATEGORY_ID);
then(nodesMock).shouldHaveNoMoreInteractions();
then(nodeServiceMock).should().getParentAssocs(CATEGORY_NODE_REF);
then(nodeServiceMock).should().getChildAssocs(CATEGORY_NODE_REF, RegexQNamePattern.MATCH_ALL, RegexQNamePattern.MATCH_ALL, false);
then(nodeServiceMock).should().setProperty(CATEGORY_NODE_REF, ContentModel.PROP_NAME, categoryNewName);
then(nodeServiceMock).should(times(2)).getPrimaryParent(CATEGORY_NODE_REF);
final QName expectedNewQName = createCmQNameOf(categoryNewName);
then(nodeServiceMock).should().moveNode(CATEGORY_NODE_REF, parentCategoryNodeRef, ContentModel.ASSOC_SUBCATEGORIES, expectedNewQName);
then(nodeServiceMock).should().getParentAssocs(parentCategoryNodeRef);
then(nodeServiceMock).shouldHaveNoMoreInteractions();
then(categoryServiceMock).shouldHaveNoInteractions();
final Category expectedCategory = createDefaultCategoryWithName(categoryNewName);
assertThat(actualCategory)
.isNotNull().usingRecursiveComparison()
.isEqualTo(expectedCategory);
}
@Test
public void testUpdateCategoryById_noPermission()
{
given(authorityServiceMock.hasAdminAuthority()).willReturn(false);
// when
assertThatExceptionOfType(PermissionDeniedException.class).isThrownBy(() -> objectUnderTest.updateCategoryById(CATEGORY_ID, CATEGORY));
then(nodesMock).shouldHaveNoInteractions();
then(nodeServiceMock).shouldHaveNoInteractions();
}
@Test
public void testUpdateCategoryById_categoryNodeNotFound()
{
given(nodesMock.validateNode(any(String.class))).willThrow(EntityNotFoundException.class);
// when
assertThatExceptionOfType(EntityNotFoundException.class).isThrownBy(() -> objectUnderTest.updateCategoryById(CATEGORY_ID, CATEGORY));
then(nodeServiceMock).shouldHaveNoInteractions();
}
@Test
public void testUpdateCategoryById_notACategory()
{
given(nodesMock.isSubClass(any(), any(), eq(false))).willReturn(false);
// when
assertThatExceptionOfType(InvalidArgumentException.class).isThrownBy(() -> objectUnderTest.updateCategoryById(CATEGORY_ID, CATEGORY))
.withMessageContaining(NOT_A_VALID_CATEGORY);
then(nodeServiceMock).shouldHaveNoInteractions();
}
@Test
public void testUpdateCategoryById_isRootCategory()
{
given(categoryServiceMock.getRootCategoryNodeRef(any())).willReturn(Optional.of(createNodeRefWithId(PATH_ROOT)));
given(nodeServiceMock.getParentAssocs(any())).willReturn(List.of(categoryChildAssociationRefMock));
given(categoryChildAssociationRefMock.getQName()).willReturn(ContentModel.ASPECT_GEN_CLASSIFIABLE);
// when
assertThatExceptionOfType(InvalidArgumentException.class).isThrownBy(() -> objectUnderTest.updateCategoryById(PATH_ROOT, CATEGORY))
.withMessageContaining(NOT_A_VALID_CATEGORY);
then(categoryServiceMock).should().getRootCategoryNodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
then(categoryServiceMock).shouldHaveNoMoreInteractions();
}
private List<String> getInvalidCategoryNames()
{
final List<String> invalidNames = new ArrayList<>();
invalidNames.add(null);
invalidNames.add("");
return invalidNames;
}
@Test
public void testUpdateCategoryById_emptyName()
{
for (String invalidName : getInvalidCategoryNames())
{
final Category categoryWithoutName = createCategoryOnlyWithName(invalidName);
// when
assertThatExceptionOfType(InvalidArgumentException.class).isThrownBy(() -> objectUnderTest.updateCategoryById(CATEGORY_ID, categoryWithoutName))
.withMessageContaining(NOT_NULL_OR_EMPTY);
}
}
@Test
public void testUpdateCategoryById_notMatchingIdField()
{
final String categoryNewName = "categoryNewName";
final Category categoryWithInvalidId = createCategoryOnlyWithName(categoryNewName);
categoryWithInvalidId.setId("different-" + CATEGORY_ID);
final QName categoryQName = createCmQNameOf(CATEGORY_NAME);
final NodeRef parentCategoryNodeRef = createNodeRefWithId(PARENT_ID);
final ChildAssociationRef parentAssociation = createAssociationOf(parentCategoryNodeRef, CATEGORY_NODE_REF, categoryQName);
given(nodesMock.getNode(any())).willReturn(prepareCategoryNode(categoryNewName));
given(nodeServiceMock.getPrimaryParent(any())).willReturn(parentAssociation);
given(nodeServiceMock.moveNode(any(), any(), any(), any())).willReturn(createAssociationOf(parentCategoryNodeRef, CATEGORY_NODE_REF, createCmQNameOf(categoryNewName)));
// when
final Category actualCategory = objectUnderTest.updateCategoryById(CATEGORY_ID, categoryWithInvalidId);
final Category expectedCategory = createDefaultCategoryWithName(categoryNewName);
assertThat(actualCategory)
.isNotNull().usingRecursiveComparison()
.isEqualTo(expectedCategory);
}
@Test
public void testUpdateCategoryById_notMatchingParentIdField()
{
final String categoryNewName = "categoryNewName";
final Category categoryWithInvalidParentId = createCategoryOnlyWithName(categoryNewName);
categoryWithInvalidParentId.setParentId("different-" + PARENT_ID);
final QName categoryQName = createCmQNameOf(CATEGORY_NAME);
final NodeRef parentCategoryNodeRef = createNodeRefWithId(PARENT_ID);
final ChildAssociationRef parentAssociation = createAssociationOf(parentCategoryNodeRef, CATEGORY_NODE_REF, categoryQName);
given(nodesMock.getNode(any())).willReturn(prepareCategoryNode(categoryNewName));
given(nodeServiceMock.getPrimaryParent(any())).willReturn(parentAssociation);
given(nodeServiceMock.moveNode(any(), any(), any(), any())).willReturn(createAssociationOf(parentCategoryNodeRef, CATEGORY_NODE_REF, createCmQNameOf(categoryNewName)));
// when
final Category actualCategory = objectUnderTest.updateCategoryById(CATEGORY_ID, categoryWithInvalidParentId);
final Category expectedCategory = createDefaultCategoryWithName(categoryNewName);
assertThat(actualCategory)
.isNotNull().usingRecursiveComparison()
.isEqualTo(expectedCategory);
}
@Test
public void testUpdateCategoryById_notMatchingHasChildrenField()
{
final String categoryNewName = "categoryNewName";
final Category categoryWithInvalidHasChildren = createCategoryOnlyWithName(categoryNewName);
categoryWithInvalidHasChildren.setHasChildren(true);
final QName categoryQName = createCmQNameOf(CATEGORY_NAME);
final NodeRef parentCategoryNodeRef = createNodeRefWithId(PARENT_ID);
final ChildAssociationRef parentAssociation = createAssociationOf(parentCategoryNodeRef, CATEGORY_NODE_REF, categoryQName);
given(nodesMock.getNode(any())).willReturn(prepareCategoryNode(categoryNewName));
given(nodeServiceMock.getPrimaryParent(any())).willReturn(parentAssociation);
given(nodeServiceMock.moveNode(any(), any(), any(), any())).willReturn(createAssociationOf(parentCategoryNodeRef, CATEGORY_NODE_REF, createCmQNameOf(categoryNewName)));
// when
final Category actualCategory = objectUnderTest.updateCategoryById(CATEGORY_ID, categoryWithInvalidHasChildren);
final Category expectedCategory = createDefaultCategoryWithName(categoryNewName);
assertThat(actualCategory)
.isNotNull().usingRecursiveComparison()
.isEqualTo(expectedCategory);
}
private Node prepareCategoryNode(final String name, final String id, final NodeRef parentNodeRef)
{
final Node categoryNode = new Node();
categoryNode.setName(name);
categoryNode.setNodeId(id);
categoryNode.setParentId(parentNodeRef);
return categoryNode;
}
private Node prepareCategoryNode(final String name)
{
final NodeRef parentNodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, PARENT_ID);
return prepareCategoryNode(name, CATEGORY_ID, parentNodeRef);
}
private Node prepareCategoryNode()
{
return prepareCategoryNode(CATEGORY_NAME);
}
private List<Category> prepareCategories()
{
return List.of(Category.builder()
.name(CATEGORY_NAME)
.create());
}
private List<ChildAssociationRef> prepareChildAssocMocks(final int count, NodeRef parentCategoryNodeRef)
{
return IntStream.range(0, count).mapToObj(i -> {
ChildAssociationRef dummyChildAssocMock = mock(ChildAssociationRef.class);
given(dummyChildAssocMock.getTypeQName()).willReturn(ContentModel.ASSOC_SUBCATEGORIES);
given(dummyChildAssocMock.getChildRef())
.willReturn(new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, CATEGORY_ID + "-" + i));
given(dummyChildAssocMock.getParentRef()).willReturn(parentCategoryNodeRef);
return dummyChildAssocMock;
}).collect(Collectors.toList());
}
private void prepareCategoryNodeMocks(ChildAssociationRef childAssociationRef)
{
final NodeRef childRef = childAssociationRef.getChildRef();
final String id = childRef.getId();
final String name = id.replace(CATEGORY_ID, CATEGORY_NAME);
final NodeRef parentRef = childAssociationRef.getParentRef();
given(nodesMock.getNode(id)).willReturn(prepareCategoryNode(name, id, parentRef));
final ChildAssociationRef parentAssoc = new ChildAssociationRef(null, parentRef, null, childRef);
given(nodeServiceMock.getPrimaryParent(childRef)).willReturn(parentAssoc);
given(nodeServiceMock.getParentAssocs(parentRef)).willReturn(List.of(parentAssoc));
}
private void doCategoryAssertions(final Category category, final int index, final String parentId)
{
final Category expectedCategory = Category.builder()
.id(CATEGORY_ID + "-" + index)
.name(CATEGORY_NAME + "-" + index)
.parentId(parentId)
.hasChildren(false)
.create();
assertEquals(expectedCategory, category);
}
private static NodeRef createNodeRefWithId(final String id)
{
return new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, id);
}
private static Category createCategoryOnlyWithName(final String name)
{
return Category.builder().name(name).create();
}
private static Category createDefaultCategoryWithName(final String name)
{
return Category.builder()
.id(CATEGORY_ID)
.name(name)
.parentId(PARENT_ID)
.hasChildren(false)
.create();
}
private static QName createCmQNameOf(final String name)
{
return QName.createQName(ContentModel.TYPE_CATEGORY.getNamespaceURI(), QName.createValidLocalName(name));
}
private static ChildAssociationRef createAssociationOf(final NodeRef parentNode, final NodeRef childNode, final QName childNodeName)
{
return new ChildAssociationRef(ContentModel.ASSOC_SUBCATEGORIES, parentNode, childNodeName, childNode);
}
}

View File

@@ -1,25 +0,0 @@
log4j.rootLogger=error, Console
log4j.appender.Console=org.apache.log4j.ConsoleAppender
log4j.appender.Console.layout=org.apache.log4j.PatternLayout
log4j.appender.Console.layout.ConversionPattern=%d{ISO8601} %x %-5p [%c{3}] [%t] %m%n
log4j.logger.org.alfresco=WARN
log4j.logger.org.alfresco.rest.api=DEBUG
log4j.logger.org.eclipse.jetty.util.log=INFO
# Renditions and Transforms
log4j.logger.org.alfresco.repo.content.transform.TransformerDebug=debug
log4j.logger.org.alfresco.repo.rendition2=debug
#log4j.logger.org.alfresco.repo.rendition2.LocalTransformClient=debug
#log4j.logger.org.alfresco.repo.rendition.RenditionServiceImpl=debug
#log4j.logger.org.alfresco.enterprise.repo.rendition2.RemoteTransformClient=debug
log4j.logger.org.alfresco.repo.thumbnail.ThumbnailServiceImplTest=DEBUG
log4j.logger.org.alfresco.repo.rendition2.RenditionService2Impl=DEBUG
#log4j.logger.org.alfresco.repo.content.transform.LocalTransformServiceRegistry=debug
#log4j.logger.org.alfresco.enterprise.repo.rendition2.RemoteTransformServiceRegistry=debug
#log4j.logger.org.alfresco.repo.rendition2.RenditionDefinitionRegistry2Impl=debug
#log4j.logger.org.alfresco.repo.content.MimetypeMap=debug
#log4j.logger.org.alfresco.repo.content.transform.LocalTransform=trace

View File

@@ -0,0 +1,56 @@
# Set root logger level to error
rootLogger.level=error
rootLogger.appenderRef.stdout.ref=ConsoleAppender
###### Console appender definition #######
# All outputs currently set to be a ConsoleAppender.
appender.console.type=Console
appender.console.name=ConsoleAppender
appender.console.layout.type=PatternLayout
appender.console.layout.pattern=%d{ISO8601} %x %-5p [%c{3}] [%t] %replace{%m}{[\r\n]+}{}%n
logger.alfresco.name=org.alfresco
logger.alfresco.level=warn
logger.alfresco-rest-api.name=org.alfresco.rest.api
logger.alfresco-rest-api.level=debug
logger.eclipse-jetty-util-log.name=org.eclipse.jetty.util.log
logger.eclipse-jetty-util-log.level=info
# Renditions and Transforms
logger.alfresco-repo-content-transform-TransformerDebug.name=org.alfresco.repo.content.transform.TransformerDebug
logger.alfresco-repo-content-transform-TransformerDebug.level=debug
logger.alfresco-repo-rendition2.name=org.alfresco.repo.rendition2
logger.alfresco-repo-rendition2.level=debug
#logger.alfresco-repo-rendition2-LocalTransformClient.name=org.alfresco.repo.rendition2.LocalTransformClient
#logger.alfresco-repo-rendition2-LocalTransformClient.level=debug
#logger.alfresco-repo-rendition-RenditionServiceImpl.name=org.alfresco.repo.rendition.RenditionServiceImpl
#logger.alfresco-repo-rendition-RenditionServiceImpl.level=debug
#logger.alfresco-enterprise-repo-rendition2-RemoteTransformClient.name=org.alfresco.enterprise.repo.rendition2.RemoteTransformClient
#logger.alfresco-enterprise-repo-rendition2-RemoteTransformClient.level=debug
logger.alfresco-repo-thumbnail-ThumbnailServiceImplTest.name=org.alfresco.repo.thumbnail.ThumbnailServiceImplTest
logger.alfresco-repo-thumbnail-ThumbnailServiceImplTest.level=debug
logger.alfresco-repo-rendition2-RenditionService2Impl.name=org.alfresco.repo.rendition2.RenditionService2Impl
logger.alfresco-repo-rendition2-RenditionService2Impl.level=debug
#logger.alfresco-repo-content-transform-LocalTransformServiceRegistry.name=org.alfresco.repo.content.transform.LocalTransformServiceRegistry
#logger.alfresco-repo-content-transform-LocalTransformServiceRegistry.level=debug
#logger.alfresco-enterprise-repo-rendition2-RemoteTransformServiceRegistry.name=org.alfresco.enterprise.repo.rendition2.RemoteTransformServiceRegistry
#logger.alfresco-enterprise-repo-rendition2-RemoteTransformServiceRegistry.level=debug
#logger.alfresco-repo-rendition2-RenditionDefinitionRegistry2Impl.name=org.alfresco.repo.rendition2.RenditionDefinitionRegistry2Impl
#logger.alfresco-repo-rendition2-RenditionDefinitionRegistry2Impl.level=debug
#logger.alfresco-repo-content-MimetypeMap.name=org.alfresco.repo.content.MimetypeMap
#logger.alfresco-repo-content-MimetypeMap.level=debug
#logger.alfresco-repo-content-transform-LocalTransform.name=org.alfresco.repo.content.transform.LocalTransform
#logger.alfresco-repo-content-transform-LocalTransform.level=trace

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo</artifactId>
<version>20.34</version>
<version>20.50-SNAPSHOT</version>
</parent>
<dependencies>

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
@@ -894,6 +894,8 @@ public interface NodeDAO extends NodeBulkLoader
Serializable nodeValue,
ChildAssocRefQueryCallback resultsCallback);
public abstract List<String> selectAssocsNotLinkedByTwoOtherAssocs(
Long parentNodeId);
/**
* Used by the re-encryptor to re-encrypt encryptable properties with a new encryption key.
*/

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2021 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
@@ -139,6 +139,8 @@ public class NodeDAOImpl extends AbstractNodeDAOImpl
private static final String SELECT_CHILD_ASSOC_OF_PARENT_BY_NAME = "alfresco.node.select_ChildAssocOfParentByName";
private static final String SELECT_CHILD_ASSOCS_OF_PARENT_WITHOUT_PARENT_ASSOCS_OF_TYPE =
"alfresco.node.select_ChildAssocsOfParentWithoutParentAssocsOfType";
private static final String SELECT_ASSOCS_NOT_LINKED_BY_TWO_OTHER_ASSOCS = "alfresco.node.select_AssocsNotLinkedByTwoOtherAssocs";
private static final String SELECT_CHILD_ASSOCS_OF_PARENT_WITHOUT_NODE_ASSOCS_OF_TYPE =
"alfresco.node.select_ChildAssocsOfParentWithoutNodeAssocsOfType";
private static final String SELECT_PARENT_ASSOCS_OF_CHILD = "alfresco.node.select_ParentAssocsOfChild";
@@ -1415,11 +1417,23 @@ public class NodeDAOImpl extends AbstractNodeDAOImpl
assoc.setOrdered(resultsCallback.orderResults());
ChildAssocResultHandler resultHandler = new ChildAssocResultHandler(resultsCallback);
template.select(SELECT_CHILD_ASSOCS_OF_PARENT_WITHOUT_PARENT_ASSOCS_OF_TYPE, assoc, resultHandler);
resultsCallback.done();
}
public List<String> selectAssocsNotLinkedByTwoOtherAssocs(
Long parentNodeId)
{
ChildAssocEntity assoc = new ChildAssocEntity();
// Parent
NodeEntity parentNode = new NodeEntity();
parentNode.setId(parentNodeId);
assoc.setParentNode(parentNode);
// Type QName
return template.selectList(SELECT_ASSOCS_NOT_LINKED_BY_TWO_OTHER_ASSOCS, assoc);
}
@Override
public List<Node> selectChildAssocsWithoutNodeAssocsOfTypes(Long parentNodeId, Long minNodeId, Long maxNodeId, Set<QName> assocTypeQNames)
{

View File

@@ -2133,7 +2133,16 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl implements Extens
// done
return results;
}
@Extend(traitAPI=NodeServiceTrait.class,extensionAPI=NodeServiceExtension.class)
public List<String> findAssocsNotLinkedByTwoOtherAssocs(NodeRef parent)
{
// Get the parent node
Pair<Long, NodeRef> nodePair = getNodePairNotNull(parent);
Long parentNodeId = nodePair.getFirst();
return nodeDAO.selectAssocsNotLinkedByTwoOtherAssocs(parentNodeId);
}
/**
* Specific properties <b>not</b> supported by {@link #getChildAssocsByPropertyValue(NodeRef, QName, Serializable)}
*/

View File

@@ -32,6 +32,7 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import org.alfresco.error.AlfrescoRuntimeException;
@@ -42,6 +43,7 @@ import org.alfresco.query.PagingResults;
import org.alfresco.repo.search.IndexerAndSearcher;
import org.alfresco.repo.search.IndexerException;
import org.alfresco.repo.tenant.TenantService;
import org.alfresco.service.Experimental;
import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.InvalidNodeRefException;
@@ -50,6 +52,7 @@ import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.repository.Path;
import org.alfresco.service.cmr.repository.StoreRef;
import org.alfresco.service.cmr.search.CategoryService;
import org.alfresco.service.cmr.search.CategoryServiceException;
import org.alfresco.service.cmr.search.LimitBy;
import org.alfresco.service.cmr.search.ResultSet;
import org.alfresco.service.cmr.search.ResultSetRow;
@@ -59,6 +62,7 @@ import org.alfresco.service.namespace.NamespacePrefixResolver;
import org.alfresco.service.namespace.QName;
import org.alfresco.util.ISO9075;
import org.alfresco.util.Pair;
import org.apache.commons.collections.CollectionUtils;
/**
* Category service implementation
@@ -67,6 +71,9 @@ import org.alfresco.util.Pair;
*/
public abstract class AbstractCategoryServiceImpl implements CategoryService
{
static final String CATEGORY_ROOT_NODE_NOT_FOUND = "Category root node not found";
static final String NODE_WITH_CATEGORY_ROOT_TYPE_NOT_FOUND = "Node with category_root type not found";
protected NodeService nodeService;
protected NodeService publicNodeService;
@@ -538,4 +545,23 @@ public abstract class AbstractCategoryServiceImpl implements CategoryService
}
public abstract List<Pair<NodeRef, Integer>> getTopCategories(StoreRef storeRef, QName aspectName, int count);
@Override
@Experimental
public Optional<NodeRef> getRootCategoryNodeRef(final StoreRef storeRef)
{
final NodeRef rootNode = nodeService.getRootNode(storeRef);
final ChildAssociationRef categoryRoot = nodeService.getChildAssocs(rootNode, Set.of(ContentModel.TYPE_CATEGORYROOT)).stream()
.findFirst()
.orElseThrow(() -> new CategoryServiceException(NODE_WITH_CATEGORY_ROOT_TYPE_NOT_FOUND));
final List<ChildAssociationRef> categoryRootAssocs = nodeService.getChildAssocs(categoryRoot.getChildRef());
if (CollectionUtils.isEmpty(categoryRootAssocs))
{
throw new CategoryServiceException(CATEGORY_ROOT_NODE_NOT_FOUND);
}
return categoryRootAssocs.stream()
.filter(ca -> ca.getQName().equals(ContentModel.ASPECT_GEN_CLASSIFIABLE))
.map(ChildAssociationRef::getChildRef)
.findFirst();
}
}

View File

@@ -504,6 +504,21 @@ public class ResetPasswordServiceImpl implements ResetPasswordService
return UrlUtil.replaceShareUrlPlaceholder(url, sysAdminParams);
}
private String getRepoBaseUrl(String url, String propName)
{
if (url == null)
{
LOGGER.warn("The url for the property [" + propName + "] is not configured.");
return "";
}
if (url.endsWith("/"))
{
url = url.substring(0, url.length() - 1);
}
return UrlUtil.replaceRepoBaseUrlPlaceholder(url, sysAdminParams);
}
protected String getResetPasswordEmailTemplate(ClientApp clientApp)
{
return clientApp.getProperty("requestResetPasswordTemplatePath");
@@ -522,20 +537,27 @@ public class ResetPasswordServiceImpl implements ResetPasswordService
StringBuilder sb = new StringBuilder(100);
String pageUrl = clientApp.getProperty("resetPasswordPageUrl");
if (StringUtils.isEmpty(pageUrl))
{
sb.append(UrlUtil.getShareUrl(sysAdminParams));
LOGGER.warn("'resetPasswordPageUrl' property is not set for the client [" + clientApp.getName()
if(!StringUtils.isEmpty(clientApp.getProperty("workspaceUrl")))
{
String workspaceUrlPlaceholder = clientApp.getProperty("workspaceUrl");
String workSpaceUrl = getRepoBaseUrl(workspaceUrlPlaceholder,"");
sb.append(UrlUtil.replaceWorkSpaceUrlPlaceholder(pageUrl,workSpaceUrl));
LOGGER.warn("Client Name is " + clientApp.getName() + " The url used is " + sb.toString());
/*sb.append("?key=").append(key)
.append("&id=").append(BPMEngineRegistry.createGlobalId(ActivitiConstants.ENGINE_ID, id));*/
}
else if(StringUtils.isEmpty(pageUrl)) {
sb.append(UrlUtil.getShareUrl(sysAdminParams));
LOGGER.warn("'resetPasswordPageUrl' property is not set for the client [" + clientApp.getName()
+ "]. The default base url of Share will be used [" + sb.toString() + "]");
}
else
{
// We pass an empty string as we know that the pageUrl is not null
sb.append(getUrl(pageUrl, ""));
}
} else {
// We pass an empty string as we know that the pageUrl is not null
sb.append(getUrl(pageUrl, ""));
}
sb.append("?key=").append(key)
sb.append("?key=").append(key)
.append("&id=").append(BPMEngineRegistry.createGlobalId(ActivitiConstants.ENGINE_ID, id));
return sb.toString();

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
@@ -48,7 +48,6 @@ import org.alfresco.query.CannedQueryFactory;
import org.alfresco.query.CannedQueryResults;
import org.alfresco.query.PagingRequest;
import org.alfresco.query.PagingResults;
import org.alfresco.repo.cache.AsynchronouslyRefreshedCache;
import org.alfresco.util.cache.RefreshableCacheEvent;
import org.alfresco.util.cache.RefreshableCacheListener;
import org.alfresco.repo.cache.SimpleCache;
@@ -1566,11 +1565,11 @@ public class AuthorityDAOImpl implements AuthorityDAO, NodeServicePolicies.Befor
{
return Collections.<String> emptySet();
}
Collection<ChildAssociationRef> childRefs = nodeService.getChildAssocsWithoutParentAssocsOfType(container, ContentModel.ASSOC_MEMBER);
List<String> rootGroupsNames = nodeService.findAssocsNotLinkedByTwoOtherAssocs(container);
Set<String> authorities = new TreeSet<String>();
for (ChildAssociationRef childRef : childRefs)
for (String rootGroupName : rootGroupsNames)
{
addAuthorityNameIfMatches(authorities, childRef.getQName().getLocalName(), type);
addAuthorityNameIfMatches(authorities, rootGroupName, type);
}
return authorities;
}

View File

@@ -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 - 2022 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.version;
import java.io.Serializable;
@@ -656,13 +656,13 @@ public class NodeServiceImpl implements NodeService, VersionModel
throw new UnsupportedOperationException(MSG_UNSUPPORTED);
}
/**
* Gets an association by ID.
*
* @param id
* the association id
* @return the association, or <code>null</code> if it does not exist
*/
/**
* Gets an association by ID.
*
* @param id
* the association id
* @return the association, or <code>null</code> if it does not exist
*/
public AssociationRef getAssoc(Long id)
{
return null;
@@ -762,7 +762,15 @@ public class NodeServiceImpl implements NodeService, VersionModel
public Collection<ChildAssociationRef> getChildAssocsWithoutParentAssocsOfType(NodeRef parent, QName assocTypeQName)
{
throw new UnsupportedOperationException(MSG_UNSUPPORTED);
}
}
/**
* @throws UnsupportedOperationException always
*/
public List<String> findAssocsNotLinkedByTwoOtherAssocs(NodeRef parent)
{
throw new UnsupportedOperationException(MSG_UNSUPPORTED);
}
/**
* Gets, converts and adds the intrinsic properties to the current node's properties

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
@@ -1467,6 +1467,11 @@ public class VirtualNodeServiceExtension extends VirtualSpringBeanExtension<Node
}
}
@Override
public List<String> findAssocsNotLinkedByTwoOtherAssocs(NodeRef nodeRef){
return getTrait().findAssocsNotLinkedByTwoOtherAssocs(nodeRef);
}
@Override
public void removeAssociation(NodeRef sourceRef, NodeRef targetRef, QName assocTypeQName)
throws InvalidNodeRefException

View File

@@ -1,37 +1,39 @@
/*
* #%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.service.cmr.search;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
import org.alfresco.api.AlfrescoPublicApi;
import org.alfresco.query.PagingRequest;
import org.alfresco.query.PagingResults;
import org.alfresco.service.Auditable;
import org.alfresco.service.Experimental;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.StoreRef;
@@ -234,10 +236,10 @@ public interface CategoryService
*/
@Auditable(parameters = {"nodeRef"})
public void deleteCategory(NodeRef nodeRef);
/**
* Get the most polular categories
*
/**
* Get the most polular categories
*
* @param storeRef StoreRef
* @param aspectName QName
* @param count int
@@ -245,4 +247,16 @@ public interface CategoryService
*/
@Auditable(parameters = {"storeRef", "aspectName", "count"})
public List<Pair<NodeRef, Integer>> getTopCategories(StoreRef storeRef, QName aspectName, int count);
/**
* Get a root category NodeRef
*
* @return NodeRef for category root node
*/
@Experimental
@Auditable(parameters = {"storeRef"})
default Optional<NodeRef> getRootCategoryNodeRef(final StoreRef storeRef)
{
return Optional.empty();
}
}

View File

@@ -0,0 +1,61 @@
/*
* #%L
* Alfresco Remote API
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.service.cmr.search;
import org.alfresco.error.AlfrescoRuntimeException;
/**
* Category Service Exception Class
*/
public class CategoryServiceException extends AlfrescoRuntimeException
{
/**
* Serial version UID
*/
private static final long serialVersionUID = 3257571687441467958L;
/**
* Construtor
*
* @param message the message string
*/
public CategoryServiceException(String message)
{
super(message);
}
/**
* Constructor
*
* @param message the message string
* @param source the source exception
*/
public CategoryServiceException(String message, Throwable source)
{
super(message, source);
}
}

View File

@@ -41,6 +41,12 @@ public class UrlUtil
public static final Pattern PATTERN = Pattern.compile("\\$\\{shareUrl\\}");
// ${alfrescoUrl} placeholder
public static final Pattern REPO_PATTERN = Pattern.compile("\\$\\{alfrescoUrl\\}");
public static final Pattern REPOBASE_PATTERN = Pattern.compile("\\$\\{repoBaseUrl\\}");
public static final Pattern WORKSPACE_PATTERN = Pattern.compile("\\$\\{workspaceUrl\\}");
/**
* Builds up the Url to Alfresco based on the settings in the
* {@link SysAdminParams}.
@@ -146,4 +152,68 @@ public class UrlUtil
url.append(context);
return url.toString();
}
/**
* Builds up the Url to Adw based on the settings in the
* {@link SysAdminParams}.
* @return Adw Url such as https://col.ab.or.ate/#/
* or http://localhost:8081/#/
*/
public static String getWorkspaceUrl(SysAdminParams sysAdminParams)
{
return buildWorkspaceUrl(
sysAdminParams.getAlfrescoProtocol(),
sysAdminParams.getAlfrescoHost(),
sysAdminParams.getAlfrescoPort());
}
protected static String buildWorkspaceUrl(String workSpaceProtocol, String workspaceHost, int workspacePort) {
StringBuilder workspaceUrl = new StringBuilder();
workspaceUrl.append(workSpaceProtocol);
workspaceUrl.append("://");
workspaceUrl.append(workspaceHost);
if ("http".equals(workSpaceProtocol) && workspacePort == 80)
{
// Not needed
}
else if ("https".equals(workSpaceProtocol) && workspacePort == 443)
{
// Not needed
}
else
{
workspaceUrl.append(':');
workspaceUrl.append(workspacePort);
}
return workspaceUrl.toString();
}
/**
* Replaces the repo base url placeholder, namely {@literal ${repoBaseUrl}}, with <b>workspace</b> url.
*
* @param value the string value which contains the repoBase url placeholder
* @param sysAdminParams the {@code SysAdminParams} object
* @return if the given {@code value} contains share url placeholder,
* the placeholder is replaced with share url; otherwise, the given {@code value} is simply returned
*/
public static String replaceRepoBaseUrlPlaceholder(String value, SysAdminParams sysAdminParams)
{
if (value != null)
{
return REPOBASE_PATTERN.matcher(value).replaceAll(getWorkspaceUrl(sysAdminParams));
}
return value;
}
public static String replaceWorkSpaceUrlPlaceholder(String pageUrl,String workspaceUrl)
{
if (pageUrl != null)
{
return WORKSPACE_PATTERN.matcher(pageUrl).replaceAll(workspaceUrl);
}
return pageUrl;
}
}

View File

@@ -20,6 +20,15 @@ repo.client-app.share.resetPasswordPageUrl=${shareUrl}/page/reset-password
repo.client-app.share.confirmResetPasswordTemplatePath=
### Digital workspace template configurations
repo.client-app.workspace.inviteModeratedTemplatePath=
repo.client-app.workspace.workspaceUrl=workspace
repo.client-app.workspace.templateAssetsUrl=${alfrescoUrl}/images
#repo.client-app.workspace.inviteModeratedTemplatePath=
repo.client-app.workspace.workspaceUrl=${repoBaseUrl}/workspace
repo.client-app.workspace.templateAssetsUrl=${workspaceUrl}/images
# reset password request email template path
repo.client-app.workspace.requestResetPasswordTemplatePath=alfresco/templates/reset-password-email-templates/forgot-password-email-template.ftl
# reset password UI page url
repo.client-app.workspace.resetPasswordPageUrl=${workspaceUrl}/reset-password/
# reset password confirmation email template path
repo.client-app.workspace.confirmResetPasswordTemplatePath=

View File

@@ -1,3 +0,0 @@
log4j.logger.org.alfresco.repo.content.transform.TransformerDebug=debug
log4j.logger.org.alfresco.util.exec.RuntimeExecBootstrapBean=debug
log4j.logger.org.alfresco.util.exec.RuntimeExec=debug

View File

@@ -0,0 +1,8 @@
logger.alfresco-repo-content-transform-TransformerDebug.name=org.alfresco.repo.content.transform.TransformerDebug
logger.alfresco-repo-content-transform-TransformerDebug.level=debug
logger.alfresco-util-exec-RuntimeExecBootstrapBean.name=org.alfresco.util.exec.RuntimeExecBootstrapBean
logger.alfresco-util-exec-RuntimeExecBootstrapBean.level=debug
logger.alfresco-util-exec-RuntimeExec.name=org.alfresco.util.exec.RuntimeExec
logger.alfresco-util-exec-RuntimeExec.level=debug

View File

@@ -1147,6 +1147,20 @@
parentNode.id = #{parentNode.id} and
a.child_node_id IS NULL
</select>
<select id="select_AssocsNotLinkedByTwoOtherAssocs" parameterType="ChildAssoc" resultType="java.lang.String">
select distinct c.qname_localname
from alf_child_assoc c
where c.parent_node_id = #{parentNode.id}
and not exists (
select 1
from alf_child_assoc a
join alf_child_assoc z
on z.parent_node_id = #{parentNode.id}
and z.child_node_id = a.parent_node_id
where c.child_node_id = a.child_node_id
);
</select>
<select id="select_ChildAssocsByPropertyValue" parameterType="ChildProperty" resultMap="result_ChildAssoc">
<include refid="alfresco.node.select_ChildAssoc_Results"/>

View File

@@ -425,6 +425,7 @@
org.alfresco.service.cmr.repository.NodeService.getStoreArchiveNode=ACL_NODE.0.sys:base.Read
org.alfresco.service.cmr.repository.NodeService.restoreNode=ACL_NODE.0.sys:base.DeleteNode,ACL_NODE.1.sys:base.CreateChildren
org.alfresco.service.cmr.repository.NodeService.getChildAssocsWithoutParentAssocsOfType=ACL_NODE.0.sys:base.ReadProperties,AFTER_ACL_NODE.sys:base.ReadProperties
org.alfresco.service.cmr.repository.NodeService.findAssocsNotLinkedByTwoOtherAssocs=ACL_NODE.0.sys:base.ReadProperties,AFTER_ACL_NODE.sys:base.ReadProperties
org.alfresco.service.cmr.repository.NodeService.countChildAssocs=ACL_NODE.0.sys:base.ReadChildren
org.alfresco.service.cmr.repository.NodeService.*=ACL_DENY
</value>
@@ -573,6 +574,7 @@
org.alfresco.service.cmr.search.CategoryService.deleteClassification=ACL_ALLOW
org.alfresco.service.cmr.search.CategoryService.deleteCategory=ACL_ALLOW
org.alfresco.service.cmr.search.CategoryService.getTopCategories=ACL_ALLOW
org.alfresco.service.cmr.search.CategoryService.getRootCategoryNodeRef=ACL_ALLOW
org.alfresco.service.cmr.search.CategoryService.*=ACL_DENY
</value>
</property>

View File

@@ -0,0 +1,12 @@
<html>
<head>
<title>Forgot Password</title>
</head>
<body>
<p>You are receiving this email because you(or someone else) requested the password reset of your account.</p>
<p>Please click on the following link, or paste this url into your browser to complete the process:</p>
<p><a href="${reset_password_url}">${reset_password_url}</a></p>
<p>If you received this in error, you can safely ignore it.</p>
<p>Kind regards</p>
</body>
</html>

View File

@@ -28,6 +28,7 @@ package org.alfresco.repo.search;
import org.alfresco.repo.search.impl.parsers.CMISTest;
import org.alfresco.repo.search.impl.parsers.CMIS_FTSTest;
import org.alfresco.repo.search.impl.parsers.FTSTest;
import org.alfresco.repo.search.impl.solr.SolrCategoryServiceImplTest;
import org.alfresco.repo.search.impl.solr.SolrChildApplicationContextFactoryTest;
import org.alfresco.repo.search.impl.solr.SolrSubsystemTest;
import org.alfresco.util.NumericEncodingTest;
@@ -46,7 +47,8 @@ import org.junit.runners.Suite;
CMISTest.class,
FTSTest.class,
SolrChildApplicationContextFactoryTest.class,
SolrSubsystemTest.class
SolrSubsystemTest.class,
SolrCategoryServiceImplTest.class
})
public class SearchTestSuite

View File

@@ -0,0 +1,93 @@
/*
* #%L
* Alfresco Remote API
* %%
* Copyright (C) 2005 - 2022 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.search.impl.solr;
import static org.junit.Assert.*;
import static org.mockito.BDDMockito.given;
import static org.mockito.BDDMockito.then;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.search.impl.noindex.NoIndexCategoryServiceImpl;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.repository.StoreRef;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
/**
* This test class covers part of the code implemented in abstract class {@link org.alfresco.repo.search.impl.AbstractCategoryServiceImpl}.
* That's because abstract class cannot be instantiated and directly tested.
*/
@RunWith(MockitoJUnitRunner.class)
public class SolrCategoryServiceImplTest
{
private static final String PATH_ROOT = "-root-";
private static final String CAT_ROOT_NODE_ID = "cat-root-node-id";
@Mock
private NodeService nodeServiceMock;
@Mock
private ChildAssociationRef categoryRootChildAssociationRefMock;
@Mock
private ChildAssociationRef categoryChildAssociationRefMock;
@InjectMocks
private NoIndexCategoryServiceImpl objectUnderTest;
@Test
public void testGetRootCategoryNodeRef()
{
final NodeRef rootNodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, PATH_ROOT);
given(nodeServiceMock.getRootNode(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE)).willReturn(rootNodeRef);
given(nodeServiceMock.getChildAssocs(rootNodeRef, Set.of(ContentModel.TYPE_CATEGORYROOT)))
.willReturn(List.of(categoryRootChildAssociationRefMock));
given(categoryChildAssociationRefMock.getQName()).willReturn(ContentModel.ASPECT_GEN_CLASSIFIABLE);
final NodeRef categoryRootNodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, CAT_ROOT_NODE_ID);
given(categoryChildAssociationRefMock.getChildRef()).willReturn(categoryRootNodeRef);
given(nodeServiceMock.getChildAssocs(categoryRootChildAssociationRefMock.getChildRef()))
.willReturn(List.of(categoryChildAssociationRefMock));
//when
final Optional<NodeRef> rooCategoryNodeRef = objectUnderTest.getRootCategoryNodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
then(nodeServiceMock).should().getRootNode(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
then(nodeServiceMock).should().getChildAssocs(rootNodeRef, Set.of(ContentModel.TYPE_CATEGORYROOT));
then(nodeServiceMock).should().getChildAssocs(categoryRootChildAssociationRefMock.getChildRef());
then(nodeServiceMock).shouldHaveNoMoreInteractions();
assertTrue(rooCategoryNodeRef.isPresent());
assertEquals(CAT_ROOT_NODE_ID, rooCategoryNodeRef.get().getId());
}
}

View File

@@ -92,6 +92,10 @@ public class ResetPasswordServiceImplTest
private static TestPerson testPerson;
private static EmailUtil emailUtil;
private static TestPerson testPersonForWorkspace;
@BeforeClass
public static void initStaticData() throws Exception
{
@@ -114,9 +118,18 @@ public class ResetPasswordServiceImplTest
.setPassword("password")
.setEmail(userName + "@example.com");
String userNameForWorkspace = "shane.doe" + System.currentTimeMillis();
testPersonForWorkspace = new TestPerson()
.setUserName(userNameForWorkspace)
.setFirstName("Shane")
.setLastName("doe")
.setPassword("password")
.setEmail(userNameForWorkspace + "@example.com");
transactionHelper.doInTransaction((RetryingTransactionCallback<Void>) () ->
{
createUser(testPerson);
createUser(testPersonForWorkspace);
return null;
});
@@ -153,6 +166,86 @@ public class ResetPasswordServiceImplTest
emailUtil.reset();
}
@Test
public void testResetPasswordForClientWorkspace() throws Exception
{
// Try the credential before change of password
authenticateUser(testPersonForWorkspace.userName, testPersonForWorkspace.password);
// Make sure to run as system
AuthenticationUtil.clearCurrentSecurityContext();
AuthenticationUtil.setRunAsUserSystem();
// Request password reset
resetPasswordService.requestReset(testPersonForWorkspace.userName, "workspace");
assertEquals("A reset password email should have been sent.", 1, emailUtil.getSentCount());
// Check the email
MimeMessage msg = emailUtil.getLastEmail();
assertNotNull("There should be an email.", msg);
assertEquals("Should've been only one email recipient.", 1, msg.getAllRecipients().length);
// Check the recipient is the person who requested the reset password
assertEquals(testPersonForWorkspace.email, msg.getAllRecipients()[0].toString());
//Check the sender is what we set as default
assertEquals(DEFAULT_SENDER, msg.getFrom()[0].toString());
// There should be a subject
assertNotNull("There should be a subject.", msg.getSubject());
// Check the default email subject - (check that we are sending the right email)
String emailSubjectKey = getDeclaredField(SendResetPasswordEmailDelegate.class, "EMAIL_SUBJECT_KEY");
assertNotNull(emailSubjectKey);
assertEquals(msg.getSubject(), I18NUtil.getMessage(emailSubjectKey));
// Check the reset password url.
String resetPasswordUrl = (String) emailUtil.getLastEmailTemplateModelValue("reset_password_url");
assertNotNull("Wrong email is sent.", resetPasswordUrl);
// Get the workflow id and key
Pair<String, String> pair = getWorkflowIdAndKeyFromUrl(resetPasswordUrl);
assertNotNull("Workflow Id can't be null.", pair.getFirst());
assertNotNull("Workflow Key can't be null.", pair.getSecond());
emailUtil.reset();
// Now that we have got the email, try to reset the password
ResetPasswordDetails passwordDetails = new ResetPasswordDetails()
.setUserId(testPersonForWorkspace.userName)
.setPassword("newPassword")
.setWorkflowId(pair.getFirst())
.setWorkflowKey(pair.getSecond());
resetPasswordService.initiateResetPassword(passwordDetails);
assertEquals("A reset password confirmation email should have been sent.", 1, emailUtil.getSentCount());
// Check the email
msg = emailUtil.getLastEmail();
assertNotNull("There should be an email.", msg);
assertEquals("Should've been only one email recipient.", 1, msg.getAllRecipients().length);
// Check the recipient is the person who requested the reset password
assertEquals(testPersonForWorkspace.email, msg.getAllRecipients()[0].toString());
// Check the sender is what we set as default
assertEquals(DEFAULT_SENDER, msg.getFrom()[0].toString());
// There should be a subject
assertNotNull("There should be a subject.", msg.getSubject());
// Check the default email subject - (check that we are sending the right email)
emailSubjectKey = getDeclaredField(SendResetPasswordConfirmationEmailDelegate.class, "EMAIL_SUBJECT_KEY");
assertNotNull(emailSubjectKey);
assertEquals(msg.getSubject(), I18NUtil.getMessage(emailSubjectKey));
// Try the old credential
TestHelper.assertThrows(() -> authenticateUser(testPersonForWorkspace.userName, testPersonForWorkspace.password),
AuthenticationException.class,
"As the user changed her password, the authentication should have failed.");
// Try the new credential
authenticateUser(testPersonForWorkspace.userName, "newPassword");
// Make sure to run as system
AuthenticationUtil.clearCurrentSecurityContext();
AuthenticationUtil.setRunAsUserSystem();
emailUtil.reset();
// Try reset again with the used workflow
TestHelper.assertThrows(() -> resetPasswordService.initiateResetPassword(passwordDetails),
InvalidResetPasswordWorkflowException.class,
"The workflow instance is not active (it has already been used).");
assertEquals("No email should have been sent.", 0, emailUtil.getSentCount());
}
@Test
public void testResetPassword() throws Exception
{

View File

@@ -1,266 +0,0 @@
#TAKEN FROM ALFRESCO_CORE PROJECT
# Set root logger level to error
log4j.rootLogger=error, Console, File
###### Console appender definition #######
# All outputs currently set to be a ConsoleAppender.
log4j.appender.Console=org.apache.log4j.ConsoleAppender
log4j.appender.Console.layout=org.apache.log4j.PatternLayout
# use log4j NDC to replace %x with tenant domain / username
log4j.appender.Console.layout.ConversionPattern=%d{ISO8601} %x %-5p [%c{3}] [%t] %m%n
#log4j.appender.Console.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c] %m%n
###### File appender definition #######
log4j.appender.File=org.apache.log4j.DailyRollingFileAppender
log4j.appender.File.File=alfresco.log
log4j.appender.File.Append=true
log4j.appender.File.DatePattern='.'yyyy-MM-dd
log4j.appender.File.layout=org.apache.log4j.PatternLayout
log4j.appender.File.layout.ConversionPattern=%d{yyyy-MM-dd} %d{ABSOLUTE} %-5p [%c] [%t] %m%n
###### Hibernate specific appender definition #######
#log4j.appender.file=org.apache.log4j.FileAppender
#log4j.appender.file.File=hibernate.log
#log4j.appender.file.layout=org.apache.log4j.PatternLayout
#log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
###### Log level overrides #######
# Commented-in loggers will be exposed as JMX MBeans (refer to org.alfresco.repo.admin.Log4JHierarchyInit)
# Hence, generally useful loggers should be listed with at least ERROR level to allow simple runtime
# control of the level via a suitable JMX Console. Also, any other loggers can be added transiently via
# Log4j addLoggerMBean as long as the logger exists and has been loaded.
# Hibernate
log4j.logger.org.hibernate=error
log4j.logger.org.hibernate.util.JDBCExceptionReporter=fatal
log4j.logger.org.hibernate.event.def.AbstractFlushingEventListener=fatal
log4j.logger.org.hibernate.type=warn
log4j.logger.org.hibernate.cfg.SettingsFactory=warn
# Spring
log4j.logger.org.springframework=warn
# Turn off Spring remoting warnings that should really be info or debug.
log4j.logger.org.springframework.remoting.support=error
log4j.logger.org.springframework.util=error
# Axis/WSS4J
log4j.logger.org.apache.axis=info
log4j.logger.org.apache.ws=info
# CXF
log4j.logger.org.apache.cxf=error
# MyFaces
log4j.logger.org.apache.myfaces.util.DebugUtils=info
log4j.logger.org.apache.myfaces.el.VariableResolverImpl=error
log4j.logger.org.apache.myfaces.application.jsp.JspViewHandlerImpl=error
log4j.logger.org.apache.myfaces.taglib=error
# log prepared statement cache activity ###
log4j.logger.org.hibernate.ps.PreparedStatementCache=info
# Alfresco
log4j.logger.org.alfresco=error
log4j.logger.org.alfresco.repo.admin=info
log4j.logger.org.alfresco.repo.cache.TransactionalCache=warn
log4j.logger.org.alfresco.repo.model.filefolder=warn
log4j.logger.org.alfresco.repo.tenant=info
log4j.logger.org.alfresco.config=warn
log4j.logger.org.alfresco.config.JndiObjectFactoryBean=warn
log4j.logger.org.alfresco.config.JBossEnabledWebApplicationContext=warn
log4j.logger.org.alfresco.repo.management.subsystems=warn
log4j.logger.org.alfresco.repo.management.subsystems.ChildApplicationContextFactory=info
log4j.logger.org.alfresco.repo.management.subsystems.ChildApplicationContextFactory$ChildApplicationContext=warn
log4j.logger.org.alfresco.repo.security.sync=info
log4j.logger.org.alfresco.repo.security.person=info
log4j.logger.org.alfresco.sample=info
log4j.logger.org.alfresco.web=info
#log4j.logger.org.alfresco.web.app.AlfrescoNavigationHandler=debug
#log4j.logger.org.alfresco.web.ui.repo.component.UIActions=debug
#log4j.logger.org.alfresco.web.ui.repo.tag.PageTag=debug
#log4j.logger.org.alfresco.web.bean.clipboard=debug
log4j.logger.org.alfresco.service.descriptor.DescriptorService=info
#log4j.logger.org.alfresco.web.page=debug
log4j.logger.org.alfresco.repo.importer.ImporterBootstrap=error
#log4j.logger.org.alfresco.repo.importer.ImporterBootstrap=info
log4j.logger.org.alfresco.repo.admin.patch.PatchExecuter=info
log4j.logger.org.alfresco.repo.domain.patch.ibatis.PatchDAOImpl=info
# Specific patches
log4j.logger.org.alfresco.repo.admin.patch.impl.DeploymentMigrationPatch=info
log4j.logger.org.alfresco.repo.version.VersionMigrator=info
log4j.logger.org.alfresco.repo.module.ModuleServiceImpl=info
log4j.logger.org.alfresco.repo.domain.schema.SchemaBootstrap=info
log4j.logger.org.alfresco.repo.admin.ConfigurationChecker=info
log4j.logger.org.alfresco.repo.node.index.AbstractReindexComponent=warn
log4j.logger.org.alfresco.repo.node.index.IndexTransactionTracker=warn
log4j.logger.org.alfresco.repo.node.index.FullIndexRecoveryComponent=info
log4j.logger.org.alfresco.repo.node.db.hibernate.HibernateNodeDaoServiceImpl=warn
log4j.logger.org.alfresco.repo.domain.hibernate.DirtySessionMethodInterceptor=warn
log4j.logger.org.alfresco.repo.transaction.RetryingTransactionHelper=debug
log4j.logger.org.alfresco.util.transaction.SpringAwareUserTransaction.trace=warn
log4j.logger.org.alfresco.util.AbstractTriggerBean=warn
log4j.logger.org.alfresco.enterprise.repo.cluster=info
log4j.logger.org.alfresco.repo.version.Version2ServiceImpl=warn
#log4j.logger.org.alfresco.repo.thumbnail=debug
#log4j.logger.org.alfresco.web.app.DebugPhaseListener=debug
log4j.logger.org.alfresco.repo.workflow=info
# FTP server debugging
log4j.logger.org.alfresco.ftp.protocol=error
#log4j.logger.org.alfresco.ftp.server=debug
# WebDAV debugging
#log4j.logger.org.alfresco.webdav.protocol=debug
log4j.logger.org.alfresco.webdav.protocol=info
# Kerberos servlet filters
#log4j.logger.org.alfresco.web.app.servlet.KerberosAuthenticationFilter=debug
#log4j.logger.org.alfresco.repo.webdav.auth.KerberosAuthenticationFilter=debug
# File servers
log4j.logger.org.alfresco.fileserver=warn
# Repo filesystem debug logging
#log4j.logger.org.alfresco.filesys.repo.ContentDiskDriver=debug
# Integrity message threshold - if 'failOnViolation' is off, then WARNINGS are generated
log4j.logger.org.alfresco.repo.node.integrity=ERROR
# Indexer debugging
log4j.logger.org.alfresco.repo.search.Indexer=error
#log4j.logger.org.alfresco.repo.search.Indexer=debug
log4j.logger.org.alfresco.repo.search.impl.lucene.index=error
log4j.logger.org.alfresco.repo.search.impl.lucene.fts.FullTextSearchIndexerImpl=warn
#log4j.logger.org.alfresco.repo.search.impl.lucene.index=DEBUG
# Audit debugging
# log4j.logger.org.alfresco.repo.audit=DEBUG
# log4j.logger.org.alfresco.repo.audit.model=DEBUG
# Property sheet and modelling debugging
# change to error to hide the warnings about missing properties and associations
log4j.logger.alfresco.missingProperties=warn
# Dictionary/Model debugging
log4j.logger.org.alfresco.repo.dictionary=warn
log4j.logger.org.alfresco.repo.dictionary.types.period=warn
# Virtualization Server Registry
log4j.logger.org.alfresco.mbeans.VirtServerRegistry=error
# Spring context runtime property setter
log4j.logger.org.alfresco.util.RuntimeSystemPropertiesSetter=info
# Debugging options for clustering
log4j.logger.org.alfresco.repo.content.ReplicatingContentStore=error
log4j.logger.org.alfresco.repo.content.replication=error
#log4j.logger.org.alfresco.repo.deploy.DeploymentServiceImpl=debug
# Activity service
log4j.logger.org.alfresco.repo.activities=warn
# User usage tracking
log4j.logger.org.alfresco.repo.usage=info
# Sharepoint
log4j.logger.org.alfresco.module.vti=info
# Forms Engine
log4j.logger.org.alfresco.web.config.forms=info
log4j.logger.org.alfresco.web.scripts.forms=info
# CMIS
log4j.logger.org.alfresco.opencmis=error
log4j.logger.org.alfresco.opencmis.AlfrescoCmisServiceInterceptor=error
log4j.logger.org.alfresco.cmis=error
log4j.logger.org.alfresco.cmis.dictionary=warn
log4j.logger.org.apache.chemistry.opencmis=info
log4j.logger.org.apache.chemistry.opencmis.server.impl.browser.CmisBrowserBindingServlet=OFF
log4j.logger.org.apache.chemistry.opencmis.server.impl.atompub.CmisAtomPubServlet=OFF
# IMAP
log4j.logger.org.alfresco.repo.imap=info
#log4j.logger.org.alfresco.repo.googledocs=debug
###### Scripting #######
# Web Framework
log4j.logger.org.springframework.extensions.webscripts=info
log4j.logger.org.springframework.extensions.webscripts.ScriptLogger=warn
log4j.logger.org.springframework.extensions.webscripts.ScriptDebugger=off
# Repository
log4j.logger.org.alfresco.repo.web.scripts=warn
log4j.logger.org.alfresco.repo.web.scripts.BaseWebScriptTest=info
log4j.logger.org.alfresco.repo.web.scripts.AlfrescoRhinoScriptDebugger=off
log4j.logger.org.alfresco.repo.jscript=error
log4j.logger.org.alfresco.repo.jscript.ScriptLogger=warn
log4j.logger.org.alfresco.repo.cmis.rest.CMISTest=info
log4j.logger.org.alfresco.repo.domain.schema.script.ScriptBundleExecutorImpl=off
log4j.logger.org.alfresco.repo.domain.schema.script.ScriptExecutorImpl=info
log4j.logger.org.alfresco.repo.domain.schema.script.DeleteNotExistsExecutor=off
log4j.logger.org.alfresco.repo.search.impl.solr.facet.SolrFacetServiceImpl=info
# Bulk Filesystem Import Tool
log4j.logger.org.alfresco.repo.bulkimport=warn
# Freemarker
# Note the freemarker.runtime logger is used to log non-fatal errors that are handled by Alfresco's retrying transaction handler
log4j.logger.freemarker.runtime=
# Metadata extraction
log4j.logger.org.alfresco.repo.content.metadata.AbstractMappingMetadataExtracter=warn
# no index support
log4j.logger.org.alfresco.repo.search.impl.noindex.NoIndexIndexer=fatal
log4j.logger.org.alfresco.repo.search.impl.noindex.NoIndexSearchService=fatal
# lucene index warnings
log4j.logger.org.alfresco.repo.search.impl.lucene.index.IndexInfo=warn
# Warn about RMI socket bind retries.
log4j.logger.org.alfresco.util.remote.server.socket.HostConfigurableSocketFactory=warn
log4j.logger.org.alfresco.repo.usage.RepoUsageMonitor=info
log4j.logger.org.alfresco.repo.site.SiteServiceImpl=DEBUG
#log4j.logger.org.alfresco.repo.action.ActionServiceImpl=DEBUG
log4j.logger.org.alfresco.repo.security.person.PersonServiceImpl=DEBUG
# identity service authentication
log4j.logger.org.alfresco.repo.security.authentication.identityservice=debug
log4j.logger.org.keycloak=debug
# Renditions and Transforms
log4j.logger.org.alfresco.repo.content.transform.TransformerDebug=debug
log4j.logger.org.alfresco.repo.rendition2=debug
#log4j.logger.org.alfresco.repo.rendition2.LocalTransformClient=debug
#log4j.logger.org.alfresco.repo.rendition.RenditionServiceImpl=debug
#log4j.logger.org.alfresco.enterprise.repo.rendition2.RemoteTransformClient=debug
log4j.logger.org.alfresco.repo.thumbnail.ThumbnailServiceImplTest=DEBUG
log4j.logger.org.alfresco.repo.rendition2.RenditionService2Impl=DEBUG
#log4j.logger.org.alfresco.repo.content.transform.LocalTransformServiceRegistry=debug
#log4j.logger.org.alfresco.enterprise.repo.rendition2.RemoteTransformServiceRegistry=debug
#log4j.logger.org.alfresco.repo.rendition2.RenditionDefinitionRegistry2Impl=debug
#log4j.logger.org.alfresco.repo.content.MimetypeMap=debug
#log4j.logger.org.alfresco.repo.content.transform.LocalTransform=trace
#log4j.logger.org.alfresco.repo.rawevents=debug
#log4j.logger.org.alfresco.repo.event2=trace

View File

@@ -0,0 +1,469 @@
# Set root logger level to error
rootLogger.level=error
rootLogger.appenderRef.stdout.ref=ConsoleAppender
rootLogger.appenderRef.rolling.ref=RollingAppender
###### Console appender definition #######
# All outputs currently set to be a ConsoleAppender.
appender.console.type=Console
appender.console.name=ConsoleAppender
appender.console.layout.type=PatternLayout
# use log4j NDC to replace %x with tenant domain / username
appender.console.layout.pattern=%d{ISO8601} %x %-5p [%c{3}] [%t] %replace{%m}{[\r\n]+}{}%n
###### File appender definition #######
appender.rolling.type=RollingFile
appender.rolling.name=RollingAppender
appender.rolling.fileName=alfresco.log
appender.rolling.filePattern=alfresco.log.%d{yyyy-MM-dd}
appender.rolling.layout.type=PatternLayout
appender.rolling.layout.pattern=%d{yyyy-MM-dd} %d{ABSOLUTE} %-5p [%c] [%t] %replace{%m}{[\r\n]+}{}%n
appender.rolling.policies.type = Policies
appender.rolling.policies.time.type = TimeBasedTriggeringPolicy
appender.rolling.policies.time.interval = 1
###### Log level overrides #######
# Commented-in loggers will be exposed as JMX MBeans (refer to org.alfresco.repo.admin.Log4JHierarchyInit)
# Hence, generally useful loggers should be listed with at least ERROR level to allow simple runtime
# control of the level via a suitable JMX Console. Also, any other loggers can be added transiently via
# Log4j addLoggerMBean as long as the logger exists and has been loaded.
# Hibernate
logger.hibernate.name=org.hibernate
logger.hibernate.level=error
logger.hibernate-util-JDBCExceptionReporter.name=org.hibernate.util.JDBCExceptionReporter
logger.hibernate-util-JDBCExceptionReporter.level=fatal
logger.hibernate-event-def-AbstractFlushingEventListener.name=org.hibernate.event.def.AbstractFlushingEventListener
logger.hibernate-event-def-AbstractFlushingEventListener.level=fatal
logger.hibernate-type.name=org.hibernate.type
logger.hibernate-type.level=warn
logger.hibernate-cfg-SettingsFactory.name=org.hibernate.cfg.SettingsFactory
logger.hibernate-cfg-SettingsFactory.level=warn
# Spring
logger.springframework.name=org.springframework
logger.springframework.level=warn
# Turn off Spring remoting warnings that should really be info or debug.
logger.springframework-remoting-support.name=org.springframework.remoting.support
logger.springframework-remoting-support.level=error
logger.springframework-util.name=org.springframework.util
logger.springframework-util.level=error
# Axis/WSS4J
logger.apache-axis.name=org.apache.axis
logger.apache-axis.level=info
logger.apache-ws.name=org.apache.ws
logger.apache-ws.level=info
# CXF
logger.apache-cxf.name=org.apache.cxf
logger.apache-cxf.level=error
# MyFaces
logger.apache-myfaces-util-DebugUtils.name=org.apache.myfaces.util.DebugUtils
logger.apache-myfaces-util-DebugUtils.level=info
logger.apache-myfaces-el-VariableResolverImpl.name=org.apache.myfaces.el.VariableResolverImpl
logger.apache-myfaces-el-VariableResolverImpl.level=error
logger.apache-myfaces-application-jsp-JspViewHandlerImpl.name=org.apache.myfaces.application.jsp.JspViewHandlerImpl
logger.apache-myfaces-application-jsp-JspViewHandlerImpl.level=error
logger.apache-myfaces-taglib.name=org.apache.myfaces.taglib
logger.apache-myfaces-taglib.level=error
# log prepared statement cache activity ###
logger.hibernate-ps-PreparedStatementCache.name=org.hibernate.ps.PreparedStatementCache
logger.hibernate-ps-PreparedStatementCache.level=info
# Alfresco
logger.alfresco.name=org.alfresco
logger.alfresco.level=error
logger.alfresco-repo-admin.name=org.alfresco.repo.admin
logger.alfresco-repo-admin.level=info
logger.alfresco-repo-transaction.name=org.alfresco.repo.transaction
logger.alfresco-repo-transaction.level=warn
logger.alfresco-repo-cache-TransactionalCache.name=org.alfresco.repo.cache.TransactionalCache
logger.alfresco-repo-cache-TransactionalCache.level=warn
logger.alfresco-repo-model-filefolder.name=org.alfresco.repo.model.filefolder
logger.alfresco-repo-model-filefolder.level=warn
logger.alfresco-repo-tenant.name=org.alfresco.repo.tenant
logger.alfresco-repo-tenant.level=info
logger.alfresco-config.name=org.alfresco.config
logger.alfresco-config.level=warn
logger.alfresco-config-JndiObjectFactoryBean.name=org.alfresco.config.JndiObjectFactoryBean
logger.alfresco-config-JndiObjectFactoryBean.level=warn
logger.alfresco-config-JBossEnabledWebApplicationContext.name=org.alfresco.config.JBossEnabledWebApplicationContext
logger.alfresco-config-JBossEnabledWebApplicationContext.level=warn
logger.alfresco-repo-management-subsystems.name=org.alfresco.repo.management.subsystems
logger.alfresco-repo-management-subsystems.level=warn
logger.alfresco-repo-management-subsystems-ChildApplicationContextFactory.name=org.alfresco.repo.management.subsystems.ChildApplicationContextFactory
logger.alfresco-repo-management-subsystems-ChildApplicationContextFactory.level=info
logger.alfresco-repo-management-subsystems-ChildApplicationContextFactory$ChildApplicationContext.name=org.alfresco.repo.management.subsystems.ChildApplicationContextFactory$ChildApplicationContext
logger.alfresco-repo-management-subsystems-ChildApplicationContextFactory$ChildApplicationContext.level=warn
logger.alfresco-repo-security-sync.name=org.alfresco.repo.security.sync
logger.alfresco-repo-security-sync.level=info
logger.alfresco-repo-security-person.name=org.alfresco.repo.security.person
logger.alfresco-repo-security-person.level=info
logger.alfresco-sample.name=org.alfresco.sample
logger.alfresco-sample.level=info
logger.alfresco-web.name=org.alfresco.web
logger.alfresco-web.level=info
#logger.alfresco-web-app-AlfrescoNavigationHandler.name=org.alfresco.web.app.AlfrescoNavigationHandler
#logger.alfresco-web-app-AlfrescoNavigationHandler.level=debug
#logger.alfresco-web-ui-repo-component-UIActions.name=org.alfresco.web.ui.repo.component.UIActions
#logger.alfresco-web-ui-repo-component-UIActions.level=debug
#logger.alfresco-web-ui-repo-tag-PageTag.name=org.alfresco.web.ui.repo.tag.PageTag
#logger.alfresco-web-ui-repo-tag-PageTag.level=debug
#logger.alfresco-web-bean-clipboard.name=org.alfresco.web.bean.clipboard
#logger.alfresco-web-bean-clipboard.level=debug
logger.alfresco-service-descriptor-DescriptorService.name=org.alfresco.service.descriptor.DescriptorService
logger.alfresco-service-descriptor-DescriptorService.level=info
#logger.alfresco-web-page.name=org.alfresco.web.page
#logger.alfresco-web-page.level=debug
logger.alfresco-repo-importer-ImporterBootstrap.name=org.alfresco.repo.importer.ImporterBootstrap
logger.alfresco-repo-importer-ImporterBootstrap.level=error
#logger.alfresco-repo-importer-ImporterBootstrap.name=org.alfresco.repo.importer.ImporterBootstrap
#logger.alfresco-repo-importer-ImporterBootstrap.level=info
logger.alfresco-repo-admin-patch-PatchExecuter.name=org.alfresco.repo.admin.patch.PatchExecuter
logger.alfresco-repo-admin-patch-PatchExecuter.level=info
logger.alfresco-repo-domain-patch-ibatis-PatchDAOImpl.name=org.alfresco.repo.domain.patch.ibatis.PatchDAOImpl
logger.alfresco-repo-domain-patch-ibatis-PatchDAOImpl.level=info
# Specific patches
logger.alfresco-repo-admin-patch-impl-DeploymentMigrationPatch.name=org.alfresco.repo.admin.patch.impl.DeploymentMigrationPatch
logger.alfresco-repo-admin-patch-impl-DeploymentMigrationPatch.level=info
logger.alfresco-repo-version-VersionMigrator.name=org.alfresco.repo.version.VersionMigrator
logger.alfresco-repo-version-VersionMigrator.level=info
logger.alfresco-repo-module-ModuleServiceImpl.name=org.alfresco.repo.module.ModuleServiceImpl
logger.alfresco-repo-module-ModuleServiceImpl.level=info
logger.alfresco-repo-domain-schema-SchemaBootstrap.name=org.alfresco.repo.domain.schema.SchemaBootstrap
logger.alfresco-repo-domain-schema-SchemaBootstrap.level=info
logger.alfresco-repo-admin-ConfigurationChecker.name=org.alfresco.repo.admin.ConfigurationChecker
logger.alfresco-repo-admin-ConfigurationChecker.level=info
logger.alfresco-repo-node-index-AbstractReindexComponent.name=org.alfresco.repo.node.index.AbstractReindexComponent
logger.alfresco-repo-node-index-AbstractReindexComponent.level=warn
logger.alfresco-repo-node-index-IndexTransactionTracker.name=org.alfresco.repo.node.index.IndexTransactionTracker
logger.alfresco-repo-node-index-IndexTransactionTracker.level=warn
logger.alfresco-repo-node-index-FullIndexRecoveryComponent.name=org.alfresco.repo.node.index.FullIndexRecoveryComponent
logger.alfresco-repo-node-index-FullIndexRecoveryComponent.level=info
#logger.alfresco-repo-node-db-hibernate-HibernateNodeDaoServiceImpl.name=org.alfresco.repo.node.db.hibernate.HibernateNodeDaoServiceImpl
#logger.alfresco-repo-node-db-hibernate-HibernateNodeDaoServiceImpl.level=warn
logger.alfresco-repo-domain-hibernate-DirtySessionMethodInterceptor.name=org.alfresco.repo.domain.hibernate.DirtySessionMethodInterceptor
logger.alfresco-repo-domain-hibernate-DirtySessionMethodInterceptor.level=warn
logger.alfresco-repo-transaction-RetryingTransactionHelper.name=org.alfresco.repo.transaction.RetryingTransactionHelper
logger.alfresco-repo-transaction-RetryingTransactionHelper.level=warn
logger.alfresco-util-transaction-SpringAwareUserTransaction-trace.name=org.alfresco.util.transaction.SpringAwareUserTransaction.trace
logger.alfresco-util-transaction-SpringAwareUserTransaction-trace.level=warn
logger.alfresco-util-AbstractTriggerBean.name=org.alfresco.util.AbstractTriggerBean
logger.alfresco-util-AbstractTriggerBean.level=warn
logger.alfresco-enterprise-repo-cluster.name=org.alfresco.enterprise.repo.cluster
logger.alfresco-enterprise-repo-cluster.level=info
logger.alfresco-repo-version-Version2ServiceImpl.name=org.alfresco.repo.version.Version2ServiceImpl
logger.alfresco-repo-version-Version2ServiceImpl.level=warn
#logger.alfresco-web-app-DebugPhaseListener.name=org.alfresco.web.app.DebugPhaseListener
#logger.alfresco-web-app-DebugPhaseListener.level=debug
logger.alfresco-repo-node-db-NodeStringLengthWorker.name=org.alfresco.repo.node.db.NodeStringLengthWorker
logger.alfresco-repo-node-db-NodeStringLengthWorker.level=info
logger.alfresco-repo-workflow.name=org.alfresco.repo.workflow
logger.alfresco-repo-workflow.level=info
# FTP server debugging
logger.alfresco-ftp-protocol.name=org.alfresco.ftp.protocol
logger.alfresco-ftp-protocol.level=error
#logger.alfresco-ftp-server.name=org.alfresco.ftp.server
#logger.alfresco-ftp-server.level=debug
# WebDAV debugging
#logger.alfresco-webdav-protocol.name=org.alfresco.webdav.protocol
#logger.alfresco-webdav-protocol.level=debug
logger.alfresco-webdav-protocol.name=org.alfresco.webdav.protocol
logger.alfresco-webdav-protocol.level=info
# Kerberos servlet filters
#logger.alfresco-web-app-servlet-KerberosAuthenticationFilter.name=org.alfresco.web.app.servlet.KerberosAuthenticationFilter
#logger.alfresco-web-app-servlet-KerberosAuthenticationFilter.level=debug
#logger.alfresco-repo-webdav-auth-KerberosAuthenticationFilter.name=org.alfresco.repo.webdav.auth.KerberosAuthenticationFilter
#logger.alfresco-repo-webdav-auth-KerberosAuthenticationFilter.level=debug
# File servers
logger.alfresco-fileserver.name=org.alfresco.fileserver
logger.alfresco-fileserver.level=warn
# Repo filesystem debug logging
#logger.alfresco-filesys-repo-ContentDiskDriver.name=org.alfresco.filesys.repo.ContentDiskDriver
#logger.alfresco-filesys-repo-ContentDiskDriver.level=debug
# Integrity message threshold - if 'failOnViolation' is off, then WARNINGS are generated
logger.alfresco-repo-node-integrity.name=org.alfresco.repo.node.integrity
logger.alfresco-repo-node-integrity.level=error
# Authentication
logger.alfresco-filesys-auth-ftp.name=org.alfresco.filesys.auth.ftp
logger.alfresco-filesys-auth-ftp.level=warn
logger.alfresco-ftp-protocol-auth.name=org.alfresco.ftp.protocol.auth
logger.alfresco-ftp-protocol-auth.level=warn
logger.alfresco-repo-webdav-auth.name=org.alfresco.repo.webdav.auth
logger.alfresco-repo-webdav-auth.level=warn
logger.alfresco-repo-web-auth.name=org.alfresco.repo.web.auth
logger.alfresco-repo-web-auth.level=warn
logger.alfresco-web-app-servlet.name=org.alfresco.web.app.servlet
logger.alfresco-web-app-servlet.level=warn
# Used also for brute force attack detection
logger.alfresco-repo-security-authentication.name=org.alfresco.repo.security.authentication
logger.alfresco-repo-security-authentication.level=warn
# Indexer debugging
logger.alfresco-repo-search-Indexer.name=org.alfresco.repo.search.Indexer
logger.alfresco-repo-search-Indexer.level=error
#logger.alfresco-repo-search-Indexer.name=org.alfresco.repo.search.Indexer
#logger.alfresco-repo-search-Indexer.level=debug
logger.alfresco-repo-search-impl-lucene-index.name=org.alfresco.repo.search.impl.lucene.index
logger.alfresco-repo-search-impl-lucene-index.level=error
logger.alfresco-repo-search-impl-lucene-fts-FullTextSearchIndexerImpl.name=org.alfresco.repo.search.impl.lucene.fts.FullTextSearchIndexerImpl
logger.alfresco-repo-search-impl-lucene-fts-FullTextSearchIndexerImpl.level=warn
#logger.alfresco-repo-search-impl-lucene-index.name=org.alfresco.repo.search.impl.lucene.index
#logger.alfresco-repo-search-impl-lucene-index.level=debug
# Audit debugging
#logger.alfresco-repo-audit.name=org.alfresco.repo.audit
#logger.alfresco-repo-audit.level=debug
#logger.alfresco-repo-audit-model.name=org.alfresco.repo.audit.model
#logger.alfresco-repo-audit-model.level=debug
# Property sheet and modelling debugging
# change to error to hide the warnings about missing properties and associations
logger.missingProperties.name=alfresco.missingProperties
logger.missingProperties.level=warn
# Dictionary/Model debugging
logger.alfresco-repo-dictionary.name=org.alfresco.repo.dictionary
logger.alfresco-repo-dictionary.level=warn
logger.alfresco-repo-dictionary-types-period.name=org.alfresco.repo.dictionary.types.period
logger.alfresco-repo-dictionary-types-period.level=warn
# Virtualization Server Registry
logger.alfresco-mbeans-VirtServerRegistry.name=org.alfresco.mbeans.VirtServerRegistry
logger.alfresco-mbeans-VirtServerRegistry.level=error
# Spring context runtime property setter
logger.alfresco-util-RuntimeSystemPropertiesSetter.name=org.alfresco.util.RuntimeSystemPropertiesSetter
logger.alfresco-util-RuntimeSystemPropertiesSetter.level=info
# Debugging options for clustering
logger.alfresco-repo-content-ReplicatingContentStore.name=org.alfresco.repo.content.ReplicatingContentStore
logger.alfresco-repo-content-ReplicatingContentStore.level=error
logger.alfresco-repo-content-replication.name=org.alfresco.repo.content.replication
logger.alfresco-repo-content-replication.level=error
#logger.alfresco-repo-deploy-DeploymentServiceImpl.name=org.alfresco.repo.deploy.DeploymentServiceImpl
#logger.alfresco-repo-deploy-DeploymentServiceImpl.level=debug
# Activity service
logger.alfresco-repo-activities.name=org.alfresco.repo.activities
logger.alfresco-repo-activities.level=warn
# User usage tracking
logger.alfresco-repo-usage.name=org.alfresco.repo.usage
logger.alfresco-repo-usage.level=info
# Sharepoint
logger.alfresco-module-vti.name=org.alfresco.module.vti
logger.alfresco-module-vti.level=info
# Forms Engine
logger.alfresco-web-config-forms.name=org.alfresco.web.config.forms
logger.alfresco-web-config-forms.level=info
logger.alfresco-web-scripts-forms.name=org.alfresco.web.scripts.forms
logger.alfresco-web-scripts-forms.level=info
# CMIS
logger.alfresco-opencmis.name=org.alfresco.opencmis
logger.alfresco-opencmis.level=error
logger.alfresco-opencmis-AlfrescoCmisServiceInterceptor.name=org.alfresco.opencmis.AlfrescoCmisServiceInterceptor
logger.alfresco-opencmis-AlfrescoCmisServiceInterceptor.level=error
logger.alfresco-cmis.name=org.alfresco.cmis
logger.alfresco-cmis.level=error
logger.alfresco-cmis-dictionary.name=org.alfresco.cmis.dictionary
logger.alfresco-cmis-dictionary.level=warn
logger.apache-chemistry-opencmis.name=org.apache.chemistry.opencmis
logger.apache-chemistry-opencmis.level=info
logger.apache-chemistry-opencmis-server-impl-browser-CmisBrowserBindingServlet.name=org.apache.chemistry.opencmis.server.impl.browser.CmisBrowserBindingServlet
logger.apache-chemistry-opencmis-server-impl-browser-CmisBrowserBindingServlet.level=off
logger.apache-chemistry-opencmis-server-impl-atompub-CmisAtomPubServlet.name=org.apache.chemistry.opencmis.server.impl.atompub.CmisAtomPubServlet
logger.apache-chemistry-opencmis-server-impl-atompub-CmisAtomPubServlet.level=off
# IMAP
logger.alfresco-repo-imap.name=org.alfresco.repo.imap
logger.alfresco-repo-imap.level=info
# JBPM
# Note: non-fatal errors (eg. logged during job execution) should be handled by Alfresco's retrying transaction handler
logger.jbpm-graph-def-GraphElement.name=org.jbpm.graph.def.GraphElement
logger.jbpm-graph-def-GraphElement.level=fatal
#logger.alfresco-repo-googledocs.name=org.alfresco.repo.googledocs
#logger.alfresco-repo-googledocs.level=debug
###### Scripting #######
# Web Framework
logger.springframework-extensions-webscripts.name=org.springframework.extensions.webscripts
logger.springframework-extensions-webscripts.level=info
logger.springframework-extensions-webscripts-ScriptLogger.name=org.springframework.extensions.webscripts.ScriptLogger
logger.springframework-extensions-webscripts-ScriptLogger.level=warn
logger.springframework-extensions-webscripts-ScriptDebugger.name=org.springframework.extensions.webscripts.ScriptDebugger
logger.springframework-extensions-webscripts-ScriptDebugger.level=off
# Repository
logger.alfresco-repo-web-scripts.name=org.alfresco.repo.web.scripts
logger.alfresco-repo-web-scripts.level=warn
logger.alfresco-repo-web-scripts-BaseWebScriptTest.name=org.alfresco.repo.web.scripts.BaseWebScriptTest
logger.alfresco-repo-web-scripts-BaseWebScriptTest.level=info
logger.alfresco-repo-web-scripts-AlfrescoRhinoScriptDebugger.name=org.alfresco.repo.web.scripts.AlfrescoRhinoScriptDebugger
logger.alfresco-repo-web-scripts-AlfrescoRhinoScriptDebugger.level=off
logger.alfresco-repo-jscript.name=org.alfresco.repo.jscript
logger.alfresco-repo-jscript.level=error
logger.alfresco-repo-jscript-ScriptLogger.name=org.alfresco.repo.jscript.ScriptLogger
logger.alfresco-repo-jscript-ScriptLogger.level=warn
logger.alfresco-repo-cmis-rest-CMISTest.name=org.alfresco.repo.cmis.rest.CMISTest
logger.alfresco-repo-cmis-rest-CMISTest.level=info
logger.alfresco-repo-domain-schema-script-ScriptBundleExecutorImpl.name=org.alfresco.repo.domain.schema.script.ScriptBundleExecutorImpl
logger.alfresco-repo-domain-schema-script-ScriptBundleExecutorImpl.level=off
logger.alfresco-repo-domain-schema-script-ScriptExecutorImpl.name=org.alfresco.repo.domain.schema.script.ScriptExecutorImpl
logger.alfresco-repo-domain-schema-script-ScriptExecutorImpl.level=info
logger.alfresco-repo-domain-schema-script-DeleteNotExistsExecutor.name=org.alfresco.repo.domain.schema.script.DeleteNotExistsExecutor
logger.alfresco-repo-domain-schema-script-DeleteNotExistsExecutor.level=off
logger.alfresco-repo-search-impl-solr-facet-SolrFacetServiceImpl.name=org.alfresco.repo.search.impl.solr.facet.SolrFacetServiceImpl
logger.alfresco-repo-search-impl-solr-facet-SolrFacetServiceImpl.level=info
# Bulk Filesystem Import Tool
logger.alfresco-repo-bulkimport.name=org.alfresco.repo.bulkimport
logger.alfresco-repo-bulkimport.level=warn
# Freemarker
# Note the freemarker.runtime logger is used to log non-fatal errors that are handled by Alfresco's retrying transaction handler
logger.runtime.name=freemarker.runtime
logger.runtime.level=
# Metadata extraction
logger.alfresco-repo-content-metadata-AbstractMappingMetadataExtracter.name=org.alfresco.repo.content.metadata.AbstractMappingMetadataExtracter
logger.alfresco-repo-content-metadata-AbstractMappingMetadataExtracter.level=warn
# no index support
logger.alfresco-repo-search-impl-noindex-NoIndexIndexer.name=org.alfresco.repo.search.impl.noindex.NoIndexIndexer
logger.alfresco-repo-search-impl-noindex-NoIndexIndexer.level=fatal
logger.alfresco-repo-search-impl-noindex-NoIndexSearchService.name=org.alfresco.repo.search.impl.noindex.NoIndexSearchService
logger.alfresco-repo-search-impl-noindex-NoIndexSearchService.level=fatal
# lucene index warnings
logger.alfresco-repo-search-impl-lucene-index-IndexInfo.name=org.alfresco.repo.search.impl.lucene.index.IndexInfo
logger.alfresco-repo-search-impl-lucene-index-IndexInfo.level=warn
# Warn about RMI socket bind retries.
logger.alfresco-util-remote-server-socket-HostConfigurableSocketFactory.name=org.alfresco.util.remote.server.socket.HostConfigurableSocketFactory
logger.alfresco-util-remote-server-socket-HostConfigurableSocketFactory.level=warn
logger.alfresco-repo-usage-RepoUsageMonitor.name=org.alfresco.repo.usage.RepoUsageMonitor
logger.alfresco-repo-usage-RepoUsageMonitor.level=info
# identity service authentication
logger.alfresco-repo-security-authentication-identityservice.name=org.alfresco.repo.security.authentication.identityservice
logger.alfresco-repo-security-authentication-identityservice.level=debug
logger.keycloak.name=org.keycloak
logger.keycloak.level=debug
# Renditions and Transforms
logger.alfresco-repo-content-transform-TransformerDebug.name=org.alfresco.repo.content.transform.TransformerDebug
logger.alfresco-repo-content-transform-TransformerDebug.level=debug
logger.alfresco-repo-rendition2.name=org.alfresco.repo.rendition2
logger.alfresco-repo-rendition2.level=debug
logger.alfresco-repo-thumbnail-ThumbnailServiceImplTest.name=org.alfresco.repo.thumbnail.ThumbnailServiceImplTest
logger.alfresco-repo-thumbnail-ThumbnailServiceImplTest.level=debug
logger.alfresco-repo-rendition2-RenditionService2Impl.name=org.alfresco.repo.rendition2.RenditionService2Impl
logger.alfresco-repo-rendition2-RenditionService2Impl.level=debug