Compare commits

..

4 Commits

Author SHA1 Message Date
canpan14
0a8052d0ab Update data-model/src/main/java/org/alfresco/service/cmr/repository/DirectAccessUrl.java
null safe comparison

Co-authored-by: Piotr Żurek <Piotr.Zurek@hyland.com>
2023-07-27 14:12:42 -04:00
canpan14
a996fe2d2f Fix bad mock and protect null pointer 2023-07-27 10:17:45 -04:00
canpan14
e0db9362a4 Only set file name if direct url is enabled 2023-07-26 14:22:18 -04:00
canpan14
63d853750e Add file name to DirectAccessUrl
This will cause it to be returned in the response
2023-07-20 11:55:48 -04:00
40 changed files with 919 additions and 854 deletions

View File

@@ -33,7 +33,7 @@ jobs:
runs-on: ubuntu-latest
if: >
!contains(github.event.head_commit.message, '[skip tests]') &&
!contains(github.event.head_commit.message, '[force')
!contains(github.event.head_commit.message, '[force]')
steps:
- uses: actions/checkout@v3
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.33.0
@@ -52,7 +52,7 @@ jobs:
if: >
((github.ref_name == 'master' || startsWith(github.ref_name, 'release/')) && github.event_name != 'pull_request') &&
!contains(github.event.head_commit.message, '[skip tests]') &&
!contains(github.event.head_commit.message, '[force')
!contains(github.event.head_commit.message, '[force]')
steps:
- uses: actions/checkout@v3
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.33.0
@@ -87,7 +87,7 @@ jobs:
if: >
!contains(github.event.head_commit.message, '[skip repo]') &&
!contains(github.event.head_commit.message, '[skip tests]') &&
!contains(github.event.head_commit.message, '[force')
!contains(github.event.head_commit.message, '[force]')
steps:
- uses: actions/checkout@v3
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.33.0
@@ -108,7 +108,7 @@ jobs:
if: >
!contains(github.event.head_commit.message, '[skip repo]') &&
!contains(github.event.head_commit.message, '[skip tests]') &&
!contains(github.event.head_commit.message, '[force')
!contains(github.event.head_commit.message, '[force]')
strategy:
fail-fast: false
matrix:
@@ -153,7 +153,7 @@ jobs:
!contains(github.event.head_commit.message, '[skip db]')) ||
contains(github.event.head_commit.message, '[db]')) &&
!contains(github.event.head_commit.message, '[skip tests]') &&
!contains(github.event.head_commit.message, '[force')
!contains(github.event.head_commit.message, '[force]')
strategy:
fail-fast: false
matrix:
@@ -183,7 +183,7 @@ jobs:
contains(github.event.head_commit.message, '[latest db]') ||
contains(github.event.head_commit.message, '[db]')) &&
!contains(github.event.head_commit.message, '[skip tests]') &&
!contains(github.event.head_commit.message, '[force')
!contains(github.event.head_commit.message, '[force]')
steps:
- uses: actions/checkout@v3
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.33.0
@@ -209,7 +209,7 @@ jobs:
contains(github.event.head_commit.message, '[latest db]') ||
contains(github.event.head_commit.message, '[db]')) &&
!contains(github.event.head_commit.message, '[skip tests]') &&
!contains(github.event.head_commit.message, '[force')
!contains(github.event.head_commit.message, '[force]')
steps:
- uses: actions/checkout@v3
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.33.0
@@ -234,7 +234,7 @@ jobs:
!contains(github.event.head_commit.message, '[skip db]')) ||
contains(github.event.head_commit.message, '[db]')) &&
!contains(github.event.head_commit.message, '[skip tests]') &&
!contains(github.event.head_commit.message, '[force')
!contains(github.event.head_commit.message, '[force]')
steps:
- uses: actions/checkout@v3
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.33.0
@@ -259,7 +259,7 @@ jobs:
contains(github.event.head_commit.message, '[latest db]') ||
contains(github.event.head_commit.message, '[db]')) &&
!contains(github.event.head_commit.message, '[skip tests]') &&
!contains(github.event.head_commit.message, '[force')
!contains(github.event.head_commit.message, '[force]')
steps:
- uses: actions/checkout@v3
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.33.0
@@ -282,7 +282,7 @@ jobs:
if: >
!contains(github.event.head_commit.message, '[skip repo]') &&
!contains(github.event.head_commit.message, '[skip tests]') &&
!contains(github.event.head_commit.message, '[force')
!contains(github.event.head_commit.message, '[force]')
steps:
- uses: actions/checkout@v3
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.33.0
@@ -303,7 +303,7 @@ jobs:
if: >
!contains(github.event.head_commit.message, '[skip repo]') &&
!contains(github.event.head_commit.message, '[skip tests]') &&
!contains(github.event.head_commit.message, '[force')
!contains(github.event.head_commit.message, '[force]')
strategy:
fail-fast: false
matrix:
@@ -372,7 +372,7 @@ jobs:
!contains(github.event.head_commit.message, '[skip tas]')) ||
contains(github.event.head_commit.message, '[tas]')) &&
!contains(github.event.head_commit.message, '[skip tests]') &&
!contains(github.event.head_commit.message, '[force')
!contains(github.event.head_commit.message, '[force]')
strategy:
fail-fast: false
matrix:
@@ -439,7 +439,7 @@ jobs:
if: >
!contains(github.event.head_commit.message, '[skip repo]') &&
!contains(github.event.head_commit.message, '[skip tests]') &&
!contains(github.event.head_commit.message, '[force')
!contains(github.event.head_commit.message, '[force]')
steps:
- uses: actions/checkout@v3
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.33.0
@@ -462,7 +462,7 @@ jobs:
!contains(github.event.head_commit.message, '[skip ags]')) ||
contains(github.event.head_commit.message, '[ags]')) &&
!contains(github.event.head_commit.message, '[skip tests]') &&
!contains(github.event.head_commit.message, '[force')
!contains(github.event.head_commit.message, '[force]')
strategy:
fail-fast: false
matrix:
@@ -493,7 +493,7 @@ jobs:
!contains(github.event.head_commit.message, '[skip ags]')) ||
contains(github.event.head_commit.message, '[ags on MySQL]')) &&
!contains(github.event.head_commit.message, '[skip tests]') &&
!contains(github.event.head_commit.message, '[force')
!contains(github.event.head_commit.message, '[force]')
strategy:
fail-fast: false
matrix:
@@ -524,7 +524,7 @@ jobs:
!contains(github.event.head_commit.message, '[skip ags]') && !contains(github.event.head_commit.message, '[skip tas]')) ||
(contains(github.event.head_commit.message, '[ags]') && contains(github.event.head_commit.message, '[tas]'))) &&
!contains(github.event.head_commit.message, '[skip tests]') &&
!contains(github.event.head_commit.message, '[force')
!contains(github.event.head_commit.message, '[force]')
env:
REQUIRES_LOCAL_IMAGES: true
steps:

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -48,7 +48,7 @@ function tagQuery()
}
query += "ASPECT:\"{http://www.alfresco.org/model/content/1.0}taggable\"";
//MNT-2118 Share inconsistencies when displaying locked files with tags
query += " AND -ASPECT:\"{http://www.alfresco.org/model/content/1.0}workingcopy\"";
query += " -ASPECT:\"{http://www.alfresco.org/model/content/1.0}workingcopy\"";
// MNT-20091 check to prevent cm:taggable with NULL
query += " AND ISNOTNULL:\"{http://www.alfresco.org/model/content/1.0}taggable\"";
@@ -60,7 +60,7 @@ function tagQuery()
query: query,
language: "lucene",
page: {
// query minimum rows because all useful info will come with facets
// query minimum rows because all usefull info will come with facets
maxItems: 1,
skipCount: 0
},

View File

@@ -24,7 +24,7 @@ function getCategoryNode()
else
{
var queryPath = "/" + catAspect + "/" + encodePath(path);
categoryResults = search.luceneSearch("+PATH:\"" + queryPath + "/*\" AND -PATH:\"" + queryPath + "/member\"");
categoryResults = search.luceneSearch("+PATH:\"" + queryPath + "/*\" -PATH:\"" + queryPath + "/member\"");
}
// make each result an object and indicate it is selectable in the UI
@@ -71,4 +71,4 @@ function encodePath(path)
function sortByName(a, b)
{
return (b.node.name.toLowerCase() > a.node.name.toLowerCase() ? -1 : 1);
}
}

View File

@@ -29,7 +29,7 @@ function main()
{
query = "+PATH:\"" + parsedArgs.pathNode.qnamePath + "//*\" ";
}
query += "AND +TYPE:\"cm:content\" AND +@cm\\:content.mimetype:\"image/*\"";
query += "+TYPE:\"cm:content\" +@cm\\:content.mimetype:image/*";
// Sort the list before trimming to page chunks
assets = search.query(
@@ -52,4 +52,4 @@ function main()
/**
* Images List Component: images
*/
model.images = main();
model.images = main();

View File

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

View File

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

View File

@@ -39,6 +39,7 @@ public class DirectAccessUrl implements Serializable
private String contentUrl;
private Date expiryTime;
private boolean attachment;
private String fileName;
public String getContentUrl()
{
@@ -70,18 +71,28 @@ public class DirectAccessUrl implements Serializable
this.attachment = attachment;
}
public String getFileName()
{
return fileName;
}
public void setFileName(String fileName)
{
this.fileName = fileName;
}
@Override public boolean equals(Object obj)
{
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
DirectAccessUrl that = (DirectAccessUrl) obj;
return attachment == that.attachment && Objects.equals(contentUrl,
return Objects.equals(fileName, that.fileName) && attachment == that.attachment && Objects.equals(contentUrl,
that.contentUrl) && Objects.equals(expiryTime, that.expiryTime);
}
@Override public int hashCode()
{
return Objects.hash(contentUrl, expiryTime, attachment);
return Objects.hash(contentUrl, expiryTime, attachment, fileName);
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,16 +1,11 @@
package org.alfresco.rest.favorites;
import java.util.List;
import org.alfresco.dataprep.CMISUtil.DocumentType;
import org.alfresco.rest.RestTest;
import org.alfresco.rest.model.RestErrorModel;
import org.alfresco.rest.model.RestPersonFavoritesModel;
import org.alfresco.rest.model.RestPersonFavoritesModelsCollection;
import org.alfresco.rest.model.RestSiteModel;
import org.alfresco.rest.search.RestRequestQueryModel;
import org.alfresco.rest.search.SearchRequest;
import org.alfresco.utility.Utility;
import org.alfresco.utility.constants.UserRole;
import org.alfresco.utility.data.DataUser.ListUserWithRoles;
import org.alfresco.utility.model.FileModel;
@@ -20,7 +15,6 @@ import org.alfresco.utility.model.TestGroup;
import org.alfresco.utility.model.UserModel;
import org.alfresco.utility.testrail.ExecutionType;
import org.alfresco.utility.testrail.annotation.TestRail;
import org.hamcrest.Matchers;
import org.springframework.http.HttpStatus;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -67,7 +61,7 @@ public class GetFavoritesTests extends RestTest
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.SANITY,
description = "Verify Manager user gets favorites with Rest API and status code is 200")
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.SANITY })
public void managerIsAbleToRetrieveFavorites()
public void managerIsAbleToRetrieveFavorites() throws Exception
{
restClient.authenticateUser(firstSiteUsers.getOneUserWithRole(UserRole.SiteManager));
restClient.withCoreAPI().usingAuthUser().addSiteToFavorites(firstSiteModel);
@@ -83,7 +77,7 @@ public class GetFavoritesTests extends RestTest
description = "Verify user gets status code 401 if authentication call fails")
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.SANITY })
// @Bug(id = "MNT-16904", description = "It fails only on environment with tenants")
public void userIsNotAbleToRetrieveFavoritesIfAuthenticationFails()
public void userIsNotAbleToRetrieveFavoritesIfAuthenticationFails() throws Exception
{
UserModel siteManager = firstSiteUsers.getOneUserWithRole(UserRole.SiteManager);
siteManager.setPassword("wrongPassword");
@@ -94,7 +88,7 @@ public class GetFavoritesTests extends RestTest
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
description = "Verify Admin user gets favorites sites with Rest API and status code is 200")
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
public void adminIsAbleToRetrieveFavoritesSites()
public void adminIsAbleToRetrieveFavoritesSites() throws Exception
{
restClient.authenticateUser(adminUserModel).withCoreAPI().usingUser(adminUserModel).addSiteToFavorites(firstSiteModel);
restClient.withCoreAPI().usingUser(adminUserModel).addSiteToFavorites(secondSiteModel);
@@ -109,7 +103,7 @@ public class GetFavoritesTests extends RestTest
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
description = "Verify Admin user gets favorites folders with Rest API and status code is 200")
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
public void adminIsAbleToRetrieveFavoritesFolders()
public void adminIsAbleToRetrieveFavoritesFolders() throws Exception
{
restClient.authenticateUser(adminUserModel).withCoreAPI().usingUser(adminUserModel).addFolderToFavorites(firstFolderModel);
restClient.withCoreAPI().usingUser(adminUserModel).addFolderToFavorites(secondFolderModel);
@@ -124,7 +118,7 @@ public class GetFavoritesTests extends RestTest
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
description = "Verify Admin user gets favorites files with Rest API and status code is 200")
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
public void adminIsAbleToRetrieveFavoritesFiles()
public void adminIsAbleToRetrieveFavoritesFiles() throws Exception
{
restClient.authenticateUser(adminUserModel).withCoreAPI().usingUser(adminUserModel).addFileToFavorites(firstFileModel);
restClient.withCoreAPI().usingUser(adminUserModel).addFileToFavorites(secondFileModel);
@@ -139,7 +133,7 @@ public class GetFavoritesTests extends RestTest
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
description = "Verify Collaborator user gets favorites with Rest API and status code is 200")
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
public void collaboratorIsAbleToRetrieveFavorites()
public void collaboratorIsAbleToRetrieveFavorites() throws Exception
{
restClient.authenticateUser(firstSiteUsers.getOneUserWithRole(UserRole.SiteCollaborator))
.withCoreAPI().usingAuthUser().addSiteToFavorites(firstSiteModel);
@@ -154,7 +148,7 @@ public class GetFavoritesTests extends RestTest
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
description = "Verify Contributor user gets favorites with Rest API and status code is 200")
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
public void contributorIsAbleToRetrieveFavorites()
public void contributorIsAbleToRetrieveFavorites() throws Exception
{
restClient.authenticateUser(firstSiteUsers.getOneUserWithRole(UserRole.SiteContributor))
.withCoreAPI().usingAuthUser().addSiteToFavorites(firstSiteModel);
@@ -169,7 +163,7 @@ public class GetFavoritesTests extends RestTest
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
description = "Verify Consumer user gets favorites with Rest API and status code is 200")
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
public void consumerIsAbleToRetrieveFavorites()
public void consumerIsAbleToRetrieveFavorites() throws Exception
{
restClient.authenticateUser(firstSiteUsers.getOneUserWithRole(UserRole.SiteConsumer))
.withCoreAPI().usingAuthUser().addSiteToFavorites(firstSiteModel);
@@ -184,7 +178,7 @@ public class GetFavoritesTests extends RestTest
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
description = "Verify user doesn't have permission to get favorites of another user with Rest API and status code is 404")
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
public void userIsNotAbleToRetrieveFavoritesOfAnotherUser()
public void userIsNotAbleToRetrieveFavoritesOfAnotherUser() throws Exception
{
restClient.authenticateUser(firstSiteUsers.getOneUserWithRole(UserRole.SiteConsumer))
.withCoreAPI().usingUser(firstSiteUsers.getOneUserWithRole(UserRole.SiteCollaborator)).getFavorites();
@@ -195,7 +189,7 @@ public class GetFavoritesTests extends RestTest
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
description = "Verify user doesn't have permission to get favorites of admin user with Rest API and status code is 200")
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
public void userIsNotAbleToRetrieveFavoritesOfAdminUser()
public void userIsNotAbleToRetrieveFavoritesOfAdminUser() throws Exception
{
restClient.authenticateUser(firstSiteUsers.getOneUserWithRole(UserRole.SiteConsumer)).withCoreAPI()
.usingUser(adminUserModel).getFavorites();
@@ -206,7 +200,7 @@ public class GetFavoritesTests extends RestTest
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
description = "Verify admin user doesn't have permission to get favorites of another user with Rest API and status code is 200")
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
public void adminIsNotAbleToRetrieveFavoritesOfAnotherUser()
public void adminIsNotAbleToRetrieveFavoritesOfAnotherUser() throws Exception
{
restClient.authenticateUser(adminUserModel).withCoreAPI().usingUser(firstSiteUsers.getOneUserWithRole(UserRole.SiteCollaborator))
.getFavorites();
@@ -217,7 +211,7 @@ public class GetFavoritesTests extends RestTest
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
description = "Verify User gets only favorites sites with Rest API and status code is 200")
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
public void userIsAbleToRetrieveOnlyFavoritesSites()
public void userIsAbleToRetrieveOnlyFavoritesSites() throws Exception
{
restClient.authenticateUser(secondSiteUsers.getOneUserWithRole(UserRole.SiteManager));
restClient.withCoreAPI().usingAuthUser().addSiteToFavorites(firstSiteModel);
@@ -235,7 +229,7 @@ public class GetFavoritesTests extends RestTest
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
description = "Verify User gets only favorites files with Rest API and status code is 200")
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
public void userIsAbleToRetrieveOnlyFavoritesFiles()
public void userIsAbleToRetrieveOnlyFavoritesFiles() throws Exception
{
restClient.authenticateUser(firstSiteUsers.getOneUserWithRole(UserRole.SiteCollaborator));
restClient.withCoreAPI().usingAuthUser().addSiteToFavorites(firstSiteModel);
@@ -253,7 +247,7 @@ public class GetFavoritesTests extends RestTest
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
description = "Verify User gets only favorites folders with Rest API and status code is 200")
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
public void userIsAbleToRetrieveOnlyFavoritesFolders()
public void userIsAbleToRetrieveOnlyFavoritesFolders() throws Exception
{
restClient.authenticateUser(firstSiteUsers.getOneUserWithRole(UserRole.SiteCollaborator));
restClient.withCoreAPI().usingAuthUser().addSiteToFavorites(firstSiteModel);
@@ -271,7 +265,7 @@ public class GetFavoritesTests extends RestTest
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
description = "Verify User gets only favorites files or folders with Rest API and status code is 200")
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
public void userIsAbleToRetrieveFavoritesFilesOrFolders()
public void userIsAbleToRetrieveFavoritesFilesOrFolders() throws Exception
{
restClient.authenticateUser(firstSiteUsers.getOneUserWithRole(UserRole.SiteConsumer));
restClient.withCoreAPI().usingAuthUser().addSiteToFavorites(firstSiteModel);
@@ -292,7 +286,7 @@ public class GetFavoritesTests extends RestTest
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
description = "Verify User gets only favorites files or sites with Rest API and status code is 200")
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
public void userIsAbleToRetrieveFavoritesFilesOrSites()
public void userIsAbleToRetrieveFavoritesFilesOrSites() throws Exception
{
restClient.authenticateUser(secondSiteUsers.getOneUserWithRole(UserRole.SiteManager));
restClient.withCoreAPI().usingAuthUser().addSiteToFavorites(firstSiteModel);
@@ -313,7 +307,7 @@ public class GetFavoritesTests extends RestTest
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
description = "Verify User gets only favorites folders or sites with Rest API and status code is 200")
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
public void userIsAbleToRetrieveFavoritesFoldersOrSites()
public void userIsAbleToRetrieveFavoritesFoldersOrSites() throws Exception
{
restClient.authenticateUser(secondSiteUsers.getOneUserWithRole(UserRole.SiteManager));
restClient.withCoreAPI().usingAuthUser().addSiteToFavorites(firstSiteModel);
@@ -334,7 +328,7 @@ public class GetFavoritesTests extends RestTest
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
description = "Verify User gets all favorites with Rest API and status code is 200")
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
public void userIsAbleToRetrieveAllFavorites()
public void userIsAbleToRetrieveAllFavorites() throws Exception
{
restClient.authenticateUser(secondSiteUsers.getOneUserWithRole(UserRole.SiteCollaborator));
restClient.withCoreAPI().usingAuthUser().addSiteToFavorites(firstSiteModel);
@@ -365,7 +359,7 @@ public class GetFavoritesTests extends RestTest
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
description = "Verify request for a user with no favorites returns status 200")
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
public void userHasNoFavorites()
public void userHasNoFavorites() throws Exception
{
restClient.authenticateUser(secondSiteUsers.getOneUserWithRole(UserRole.SiteContributor));
@@ -377,7 +371,7 @@ public class GetFavoritesTests extends RestTest
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
description = "Verify request using invalid where parameter returns status 400")
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
public void getFavoritesUsingInvalidWhereParameter()
public void getFavoritesUsingInvalidWhereParameter() throws Exception
{
restClient.authenticateUser(firstSiteUsers.getOneUserWithRole(UserRole.SiteConsumer));
restClient.withCoreAPI().usingAuthUser().addSiteToFavorites(firstSiteModel);
@@ -393,7 +387,7 @@ public class GetFavoritesTests extends RestTest
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
description = "Verify User gets correct favorites after deleting a favorite")
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
public void checkFavoriteFolderIsRemoved()
public void checkFavoriteFolderIsRemoved() throws Exception
{
restClient.authenticateUser(firstSiteUsers.getOneUserWithRole(UserRole.SiteManager));
restClient.withCoreAPI().usingAuthUser().addSiteToFavorites(firstSiteModel);
@@ -411,7 +405,7 @@ public class GetFavoritesTests extends RestTest
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
description = "Verify get favorites specifying -me- string in place of <personid> for request")
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
public void userIsAbleToGetFavoritesWhenUsingMeAsUsername()
public void userIsAbleToGetFavoritesWhenUsingMeAsUsername() throws Exception
{
userFavorites = restClient.authenticateUser(userModel).withCoreAPI().usingMe().getFavorites();
restClient.assertStatusCodeIs(HttpStatus.OK);
@@ -421,7 +415,7 @@ public class GetFavoritesTests extends RestTest
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
description = "Verify get favorites using empty for where parameter for request")
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
public void userIsAbleToGetFavoritesWhenUsingEmptyWhereParameter()
public void userIsAbleToGetFavoritesWhenUsingEmptyWhereParameter() throws Exception
{
userFavorites = restClient.authenticateUser(adminUserModel).withCoreAPI().usingAuthUser().where().getFavorites();
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST)
@@ -431,7 +425,7 @@ public class GetFavoritesTests extends RestTest
@TestRail(section = { TestGroup.REST_API,TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
description = "Verify that for invalid maxItems parameter status code returned is 400.")
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
public void checkInvalidMaxItemsStatusCode()
public void checkInvalidMaxItemsStatusCode() throws Exception
{
restClient.authenticateUser(adminUserModel).withParams("maxItems=AB").withCoreAPI().usingUser(adminUserModel).getFavorites();
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError().containsSummary("Invalid paging parameter");
@@ -440,7 +434,7 @@ public class GetFavoritesTests extends RestTest
@TestRail(section = { TestGroup.REST_API,TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
description = "Verify that for invalid skipCount parameter status code returned is 400.")
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
public void checkInvalidSkipCountStatusCode()
public void checkInvalidSkipCountStatusCode() throws Exception
{
restClient.authenticateUser(adminUserModel).withParams("skipCount=AB").withCoreAPI().usingUser(adminUserModel).getFavorites();
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError().containsSummary("Invalid paging parameter");
@@ -449,7 +443,7 @@ public class GetFavoritesTests extends RestTest
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
description = "Verify get favorites when using invalid network id for non-tenant user")
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
public void getFavoritesWhenNetworkIdIsInvalid()
public void getFavoritesWhenNetworkIdIsInvalid() throws Exception
{
UserModel networkUserModel = dataUser.createRandomTestUser();
networkUserModel.setDomain("invalidNetwork");
@@ -460,7 +454,7 @@ public class GetFavoritesTests extends RestTest
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
description = "Verify get favorites using AND instead of OR in where parameter for request")
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
public void userIsNotAbleToGetFavoritesWhenUsingANDInWhereParameter()
public void userIsNotAbleToGetFavoritesWhenUsingANDInWhereParameter() throws Exception
{
userFavorites = restClient.withCoreAPI().usingAuthUser().where().targetFolderExist().invalidWhereParameter("AND").targetFileExist().getFavorites();
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST)
@@ -470,7 +464,7 @@ public class GetFavoritesTests extends RestTest
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
description = "Verify get favorites using wrong name instead of EXISTS in where parameter for request")
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
public void userIsNotAbleToGetFavoritesWhenUsingWrongWhereParameter()
public void userIsNotAbleToGetFavoritesWhenUsingWrongWhereParameter() throws Exception
{
userFavorites = restClient.withCoreAPI().usingAuthUser().where().invalidWhereParameter("EXIST((target/site))").targetFileExist().getFavorites();
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST)
@@ -480,7 +474,7 @@ public class GetFavoritesTests extends RestTest
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
description = "Verify get favorites except the first one for request")
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
public void userIsAbleToGetFavoritesExceptTheFirstOne()
public void userIsAbleToGetFavoritesExceptTheFirstOne() throws Exception
{
userFavorites = restClient.authenticateUser(userModel).withParams("skipCount=1").withCoreAPI().usingUser(userModel).getFavorites();
restClient.assertStatusCodeIs(HttpStatus.OK);
@@ -493,7 +487,7 @@ public class GetFavoritesTests extends RestTest
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
description = "Verify get first two favorites sites")
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
public void userIsAbleToGetFirstTwoFavorites()
public void userIsAbleToGetFirstTwoFavorites() throws Exception
{
userFavorites = restClient.authenticateUser(userModel).withParams("maxItems=2").withCoreAPI().usingUser(userModel).getFavorites();
restClient.assertStatusCodeIs(HttpStatus.OK);
@@ -509,7 +503,7 @@ public class GetFavoritesTests extends RestTest
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
description = "Verify get favorites sites when using empty values for skipCount and maxItems")
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
public void userIsAbleToGetFavoritesWhenSkipCountAndMaxItemsAreEmpty()
public void userIsAbleToGetFavoritesWhenSkipCountAndMaxItemsAreEmpty() throws Exception
{
restClient.authenticateUser(userModel).withParams("skipCount= ").withCoreAPI().usingUser(userModel).getFavorites();
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError().containsSummary(String.format(RestErrorModel.INVALID_SKIPCOUNT, " "));
@@ -521,7 +515,7 @@ public class GetFavoritesTests extends RestTest
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
description = "Verify the get favorites request for a high value for skipCount parameter")
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
public void userIsAbleToGetFavoritesWithHighSkipCount()
public void userIsAbleToGetFavoritesWithHighSkipCount() throws Exception
{
userFavorites = restClient.authenticateUser(userModel).withParams("skipCount=999999999").withCoreAPI().usingUser(userModel).getFavorites();
restClient.assertStatusCodeIs(HttpStatus.OK);
@@ -532,7 +526,7 @@ public class GetFavoritesTests extends RestTest
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
description = "Verify the get favorites request with properties parameter applied")
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
public void userIsAbleToGetFavoritesWithPropertiesParamApplied()
public void userIsAbleToGetFavoritesWithPropertiesParamApplied() throws Exception
{
userFavorites = restClient.authenticateUser(userModel).withParams("properties=targetGuid").withCoreAPI().usingUser(userModel).getFavorites();
restClient.assertStatusCodeIs(HttpStatus.OK);
@@ -543,7 +537,7 @@ public class GetFavoritesTests extends RestTest
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION, description = "Verify entry details for get favorites response with Rest API")
public void checkResponseSchemaForGetFavorites()
public void checkResponseSchemaForGetFavorites() throws Exception
{
userFavorites = restClient.authenticateUser(userModel).withCoreAPI().usingAuthUser().getFavorites();
restClient.assertStatusCodeIs(HttpStatus.OK);
@@ -559,12 +553,11 @@ public class GetFavoritesTests extends RestTest
.field("title").is(thirdSiteModel.getTitle());
}
@Test(groups = {TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION})
@TestRail(section = {TestGroup.REST_API, TestGroup.FAVORITES}, executionType = ExecutionType.REGRESSION,
description = "Verify if get favorites response returns allowableOperations object when requested")
public void checkResponsesForGetFavoritesWithAllowableOperations()
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION, description = "Verify if get favorites response returns allowableOperations object when requested")
public void checkResponseForGetFavoritesWithAllowableOperations()
{
final RestPersonFavoritesModelsCollection adminFavorites =
RestPersonFavoritesModelsCollection adminFavorites =
restClient.authenticateUser(adminUserModel).withCoreAPI().usingAuthUser().include(ALLOWABLE_OPERATIONS).getFavorites();
restClient.assertStatusCodeIs(HttpStatus.OK);
@@ -572,22 +565,4 @@ public class GetFavoritesTests extends RestTest
.map(RestPersonFavoritesModel::onModel)
.forEach(m -> m.assertThat().field(ALLOWABLE_OPERATIONS).isNotEmpty());
}
@TestRail(section = {TestGroup.REST_API, TestGroup.FAVORITES}, executionType = ExecutionType.REGRESSION,
description = "Verify the get favorites request with properties parameter applied")
@Test(groups = {TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION})
public void checkSearchResponseContainsIsFavoriteWhenRequested() throws InterruptedException {
final SearchRequest query = new SearchRequest();
final RestRequestQueryModel queryReq = new RestRequestQueryModel();
queryReq.setQuery(firstFileModel.getName());
query.setQuery(queryReq);
query.setInclude(List.of("isFavorite"));
Utility.sleep(500, 60000, () ->
{
restClient.authenticateUser(adminUserModel).withSearchAPI().search(query);
restClient.onResponse().assertThat().body("list.entries.entry[0].isFavorite", Matchers.notNullValue());
}
);
}
}

View File

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

View File

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

View File

@@ -388,6 +388,12 @@
<load-on-startup>8</load-on-startup>
</servlet>
<servlet>
<servlet-name>cmistck</servlet-name>
<servlet-class>org.apache.chemistry.opencmis.tck.runner.WebRunnerServlet</servlet-class>
<load-on-startup>8</load-on-startup>
</servlet>
<servlet>
<servlet-name>publicapiServlet</servlet-name>
<servlet-class>org.alfresco.rest.api.PublicApiWebScriptServlet</servlet-class>
@@ -463,6 +469,14 @@
<servlet-name>publicapiServlet</servlet-name>
<url-pattern>/api/*</url-pattern>
</servlet-mapping>
<!-- The CMIS TCK is deactivated by default. -->
<!-- CMISTCK
<servlet-mapping>
<servlet-name>cmistck</servlet-name>
<url-pattern>/cmistck</url-pattern>
</servlet-mapping>
CMISTCK -->
<!-- Enterprise servlet-mapping placeholder -->

38
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>23.1.0.178</version>
<version>23.1.0.167-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Alfresco Community Repo Parent</name>
@@ -63,7 +63,7 @@
<dependency.opencmis.version>1.0.0</dependency.opencmis.version>
<dependency.webscripts.version>8.45</dependency.webscripts.version>
<dependency.bouncycastle.version>1.70</dependency.bouncycastle.version>
<dependency.mockito-core.version>5.4.0</dependency.mockito-core.version>
<dependency.mockito-core.version>4.9.0</dependency.mockito-core.version>
<dependency.assertj.version>3.24.2</dependency.assertj.version>
<dependency.org-json.version>20230618</dependency.org-json.version>
<dependency.commons-dbcp.version>2.9.0</dependency.commons-dbcp.version>
@@ -84,8 +84,10 @@
<dependency.poi.version>5.2.2</dependency.poi.version>
<dependency.poi-ooxml-lite.version>5.2.3</dependency.poi-ooxml-lite.version>
<dependency.jboss.logging.version>3.5.0.Final</dependency.jboss.logging.version>
<dependency.camel.version>3.21.0</dependency.camel.version> <!-- when bumping this version, please keep track/sync with included netty.io dependencies -->
<dependency.netty.version>4.1.95.Final</dependency.netty.version> <!-- must be in sync with camels transitive dependencies, e.g.: netty-common -->
<dependency.camel.version>3.20.2</dependency.camel.version> <!-- when bumping this version, please keep track/sync with included netty.io dependencies -->
<dependency.netty.version>4.1.87.Final</dependency.netty.version> <!-- must be in sync with camels transitive dependencies, e.g.: netty-common -->
<dependency.netty.qpid.version>4.1.82.Final</dependency.netty.qpid.version> <!-- must be in sync with camels transitive dependencies: native-unix-common/native-epoll/native-kqueue -->
<dependency.netty-tcnative.version>2.0.56.Final</dependency.netty-tcnative.version> <!-- must be in sync with camels transitive dependencies -->
<dependency.activemq.version>5.17.4</dependency.activemq.version>
<dependency.apache-compress.version>1.23.0</dependency.apache-compress.version>
<dependency.apache.taglibs.version>1.2.5</dependency.apache.taglibs.version>
@@ -148,7 +150,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>23.1.0.178</tag>
<tag>HEAD</tag>
</scm>
<distributionManagement>
@@ -386,11 +388,7 @@
<artifactId>commons-fileupload</artifactId>
<version>1.5</version>
</dependency>
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
<version>3.9.0</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
@@ -853,6 +851,17 @@
<artifactId>camel-mock</artifactId>
<version>${dependency.camel.version}</version>
</dependency>
<!-- Netty non-transitive dependencies declared for depending projects usage in conjunction with Camel's other transitive netty dependencies -->
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-handler-proxy</artifactId>
<version>${dependency.netty.version}</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-tcnative-classes</artifactId>
<version>${dependency.netty-tcnative.version}</version>
</dependency>
<dependency>
<groupId>org.apache.taglibs</groupId>
@@ -897,15 +906,6 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-bom</artifactId>
<version>${dependency.netty.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-bom</artifactId>

View File

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

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo</artifactId>
<version>23.1.0.178</version>
<version>23.1.0.167-SNAPSHOT</version>
</parent>
<dependencies>
@@ -741,6 +741,7 @@
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
<version>3.8.0</version>
<scope>test</scope>
</dependency>
<dependency>

View File

@@ -655,6 +655,9 @@ public class ContentServiceImpl implements ContentService, ApplicationContextAwa
try
{
directAccessUrl = store.requestContentDirectUrl(contentUrl, attachment, fileName, contentMimetype, validFor);
if (directAccessUrl != null) {
directAccessUrl.setFileName(fileName);
}
}
catch (UnsupportedOperationException ex)
{

View File

@@ -69,22 +69,22 @@ public class AlfrescoRmiRegistryFactoryBean implements FactoryBean<Registry>, Di
if (LOG.isDebugEnabled()) {
LOG.debug("Looking for RMI registry at port '" + this.port + "', using custom socket factory");
}
Registry registry;
synchronized (LocateRegistry.class) {
try {
// Retrieve existing registry.
final Registry localRegistry = LocateRegistry.getRegistry(null, this.port, socketFactory);
testRegistry(localRegistry);
return localRegistry;
registry = LocateRegistry.getRegistry(null, this.port, socketFactory);
testRegistry(this.registry);
}
catch (RemoteException ex) {
LOG.trace("RMI registry access threw exception", ex);
LOG.debug("Could not detect RMI registry - creating new one");
// Assume no registry found -> create new one.
this.created = true;
return LocateRegistry.createRegistry(this.port, socketFactory, socketFactory);
registry = LocateRegistry.createRegistry(this.port, socketFactory, socketFactory);
}
}
return registry;
}
public boolean isEnabled()

View File

@@ -166,34 +166,46 @@ public class ContentServiceImplUnitTest
@Test
public void testRequestContentDirectUrl_StoreRequestContentDirectUrlIsCalledWithFileNameOverride()
{
DirectAccessUrl mockDirectAccessUrl = new DirectAccessUrl();
mockDirectAccessUrl.setAttachment(true);
mockDirectAccessUrl.setContentUrl(SOME_CONTENT_URL);
final String fileNameOverride = "fileNameOverride.txt";
setupSystemWideDirectAccessConfig(ENABLED);
when(mockContentStore.isContentDirectUrlEnabled()).thenReturn(ENABLED);
when(mockContentStore.requestContentDirectUrl(anyString(), eq(true), eq(fileNameOverride), anyString(), anyLong())).thenReturn(mockDirectAccessUrl);
DirectAccessUrl directAccessUrl = contentService.requestContentDirectUrl(NODE_REF, PROP_CONTENT_QNAME, true, 20L, fileNameOverride);
assertNull(directAccessUrl);
assertEquals("fileName was not set properly on the DirectAccessUrl response", fileNameOverride, directAccessUrl.getFileName());
verify(mockContentStore, times(1)).requestContentDirectUrl(anyString(), eq(true), eq(fileNameOverride), anyString(), anyLong());
}
@Test
public void testRequestContentDirectUrl_StoreRequestContentDirectUrlIsCalledWithNodeNamePropertyWhenFileNameOverrideIsNull()
{
DirectAccessUrl mockDirectAccessUrl = new DirectAccessUrl();
mockDirectAccessUrl.setAttachment(true);
mockDirectAccessUrl.setContentUrl(SOME_CONTENT_URL);
setupSystemWideDirectAccessConfig(ENABLED);
when(mockContentStore.isContentDirectUrlEnabled()).thenReturn(ENABLED);
when(mockContentStore.requestContentDirectUrl(anyString(), eq(true), eq(SOME_FILE_NAME), anyString(), anyLong())).thenReturn(mockDirectAccessUrl);
DirectAccessUrl directAccessUrl = contentService.requestContentDirectUrl(NODE_REF, PROP_CONTENT_QNAME, true, 20L, null);
assertNull(directAccessUrl);
assertEquals("fileName was not set properly on the DirectAccessUrl response", SOME_FILE_NAME, directAccessUrl.getFileName());
verify(mockContentStore, times(1)).requestContentDirectUrl(anyString(), eq(true), eq(SOME_FILE_NAME), anyString(), anyLong());
}
@Test
public void testRequestContentDirectUrl_StoreRequestContentDirectUrlIsCalledWithNodeNamePropertyWhenFileNameOverrideIsEmpty()
{
DirectAccessUrl mockDirectAccessUrl = new DirectAccessUrl();
mockDirectAccessUrl.setAttachment(true);
mockDirectAccessUrl.setContentUrl(SOME_CONTENT_URL);
setupSystemWideDirectAccessConfig(ENABLED);
when(mockContentStore.isContentDirectUrlEnabled()).thenReturn(ENABLED);
when(mockContentStore.requestContentDirectUrl(anyString(), eq(true), eq(SOME_FILE_NAME), anyString(), anyLong())).thenReturn(mockDirectAccessUrl);
DirectAccessUrl directAccessUrl = contentService.requestContentDirectUrl(NODE_REF, PROP_CONTENT_QNAME, true, 20L, "");
assertNull(directAccessUrl);
assertEquals("fileName was not set properly on the DirectAccessUrl response", SOME_FILE_NAME, directAccessUrl.getFileName());
verify(mockContentStore, times(1)).requestContentDirectUrl(anyString(), eq(true), eq(SOME_FILE_NAME), anyString(), anyLong());
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2023 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
@@ -34,7 +34,6 @@ import static org.alfresco.model.ContentModel.ASSOC_MEMBER;
import static org.alfresco.model.ContentModel.TYPE_CONTENT;
import static org.alfresco.model.ContentModel.TYPE_FOLDER;
import static org.alfresco.repo.rule.RuleModel.ASPECT_IGNORE_INHERITED_RULES;
import static org.alfresco.repo.rule.RuleModel.ASPECT_RULES;
import static org.alfresco.repo.rule.RuleModel.ASSOC_ACTION;
import static org.alfresco.repo.rule.RuleModel.ASSOC_RULE_FOLDER;
import static org.alfresco.repo.rule.RuleModel.TYPE_RULE;
@@ -49,7 +48,11 @@ import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.nullable;
import static org.mockito.BDDMockito.given;
import static org.mockito.BDDMockito.then;
import static org.mockito.Mockito.*;
import static org.mockito.Mockito.atLeastOnce;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;
import static org.mockito.MockitoAnnotations.openMocks;
import java.io.Serializable;
@@ -94,7 +97,7 @@ public class RuleServiceImplUnitTest
@Mock
private PermissionService permissionService;
@Mock
private SimpleCache<NodeRef, List<Rule>> nodeRulesCache;
private SimpleCache nodeRulesCache;
@Mock
private NodeService runtimeNodeService;
@Mock
@@ -135,12 +138,12 @@ public class RuleServiceImplUnitTest
// Call the method under test.
ruleService.saveRule(FOLDER_NODE, mockRule);
then(nodeService).should(times(2)).hasAspect(FOLDER_NODE, ASPECT_RULES);
then(nodeService).should(times(2)).hasAspect(FOLDER_NODE, RuleModel.ASPECT_RULES);
then(nodeService).should().exists(FOLDER_NODE);
then(nodeService).should().addAspect(FOLDER_NODE, ASPECT_RULES, null);
then(nodeService).should().addAspect(FOLDER_NODE, RuleModel.ASPECT_RULES, null);
then(nodeService).should().createNode(eq(RULE_SET_NODE), eq(ASSOC_CONTAINS), any(QName.class), eq(TYPE_RULE));
then(nodeService).should(atLeastOnce()).setProperty(eq(RULE_NODE), any(QName.class), nullable(Serializable.class));
then(nodeService).should().getChildAssocs(RULE_NODE, ASSOC_ACTION, ASSOC_ACTION);
then(nodeService).should().getChildAssocs(RULE_NODE, RuleModel.ASSOC_ACTION, RuleModel.ASSOC_ACTION);
verifyNoMoreInteractions(nodeService);
}
@@ -426,7 +429,7 @@ public class RuleServiceImplUnitTest
Map<NodeRef, String> invertedMap = MapUtils.invertMap(nodes);
String nodeNames = actual.stream().map(invertedMap::get).collect(joining(","));
assertEquals("Node names should match expected string", "A,B,C,D,E", nodeNames);
assertEquals("A,B,C,D,E", nodeNames);
}
/** Check that ordered parents are returned in the correct order. */
@@ -440,7 +443,7 @@ public class RuleServiceImplUnitTest
Map<NodeRef, String> invertedMap = MapUtils.invertMap(nodes);
String nodeNames = actual.stream().map(invertedMap::get).collect(joining(","));
assertEquals("Node names should match expected string", "A,B,C,D,E", nodeNames);
assertEquals("A,B,C,D,E", nodeNames);
}
/** Check that the ASPECT_IGNORE_INHERITED_RULES aspect breaks the chain. */
@@ -455,7 +458,7 @@ public class RuleServiceImplUnitTest
Map<NodeRef, String> invertedMap = MapUtils.invertMap(nodes);
String nodeNames = actual.stream().map(invertedMap::get).collect(joining(","));
assertEquals("Node names should match expected string", "C,D,E", nodeNames);
assertEquals("C,D,E", nodeNames);
}
/** Check that the user group hierarchy is not traversed. */
@@ -472,7 +475,7 @@ public class RuleServiceImplUnitTest
Map<NodeRef, String> invertedMap = MapUtils.invertMap(nodes);
String nodeNames = actual.stream().map(invertedMap::get).collect(joining(","));
assertEquals("Node names should match expected string", "C,D,E", nodeNames);
assertEquals("C,D,E", nodeNames);
}
/** Check that a cycle doesn't cause a problem. */
@@ -486,7 +489,7 @@ public class RuleServiceImplUnitTest
Map<NodeRef, String> invertedMap = MapUtils.invertMap(nodes);
String nodeNames = actual.stream().map(invertedMap::get).collect(joining(","));
assertEquals("Node names should match expected string", "A,B,C", nodeNames);
assertEquals("A,B,C", nodeNames);
}
/** Check that a diamond of nodes is traversed correctly. */
@@ -500,7 +503,7 @@ public class RuleServiceImplUnitTest
Map<NodeRef, String> invertedMap = MapUtils.invertMap(nodes);
String nodeNames = actual.stream().map(invertedMap::get).collect(joining(","));
assertEquals("Node names should match expected string", "A,B,C,D", nodeNames);
assertEquals("A,B,C,D", nodeNames);
}
/**
@@ -525,7 +528,7 @@ public class RuleServiceImplUnitTest
Map<NodeRef, String> invertedMap = MapUtils.invertMap(nodes);
String nodeNames = actual.stream().map(invertedMap::get).collect(joining(","));
assertEquals("Node names should match expected string", "A,C,B,E,D,F,G", nodeNames);
assertEquals("A,C,B,E,D,F,G", nodeNames);
}
/**
@@ -550,7 +553,7 @@ public class RuleServiceImplUnitTest
Map<NodeRef, String> invertedMap = MapUtils.invertMap(nodes);
String nodeNames = actual.stream().map(invertedMap::get).collect(joining(","));
assertEquals("Node names should match expected string", "A,D,C,F,B,E,G", nodeNames);
assertEquals("A,D,C,F,B,E,G", nodeNames);
}
/**

View File

@@ -8,37 +8,36 @@
<property name="location" value="test-messaging.properties" />
</bean>
<bean id="transactionAwareEventProducer" class="org.mockito.Mockito" factory-method="mock">
<constructor-arg type="java.lang.Class" value="org.alfresco.repo.rawevents.TransactionAwareEventProducer" />
</bean>
<bean id="policyComponent" class="org.mockito.Mockito" factory-method="mock">
<constructor-arg type="java.lang.Class" value="org.alfresco.repo.policy.PolicyComponentImpl"/>
</bean>
<bean id="transformRequestProcessor" class="org.mockito.Mockito" factory-method="mock">
<constructor-arg type="java.lang.Class" value="org.alfresco.repo.rendition2.TransformRequestProcessor" />
</bean>
<import resource="classpath:/alfresco/subsystems/Messaging/default/messaging-context.xml" />
<bean id="messagingExceptionProcessor"
class="org.alfresco.messaging.camel.MockExceptionProcessor" />
<bean id="mockConsumer"
class="org.alfresco.messaging.camel.MockConsumer" />
<bean id="mockExceptionThrowingConsumer"
class="org.alfresco.messaging.camel.MockExceptionThrowingConsumer" />
<bean id="messagingExceptionProcessor"
class="org.alfresco.messaging.camel.MockExceptionProcessor" />
<bean id="mockConsumer"
class="org.alfresco.messaging.camel.MockConsumer" />
<bean id="mockExceptionThrowingConsumer"
class="org.alfresco.messaging.camel.MockExceptionThrowingConsumer" />
<import resource="testRoutes.xml" />
<bean id="testNewRouteLoader" class="org.alfresco.messaging.camel.SpringContextRouteLoader">
<property name="camelContextId" value="alfrescoCamelContext" />
<property name="routeContextId" value="customRoutes" />
</bean>
<bean id="renditionEventProcessor" class="org.mockito.Mockito" factory-method="mock">
<constructor-arg type="java.lang.Class" value="org.alfresco.repo.rendition2.RenditionEventProcessor"/>
<bean id="transactionAwareEventProducer" class="org.mockito.Mockito" factory-method="mock">
<constructor-arg value="org.alfresco.repo.rawevents.TransactionAwareEventProducer" />
</bean>
<bean id="policyComponent" class="org.mockito.Mockito" factory-method="mock">
<constructor-arg value="org.alfresco.repo.policy.PolicyComponentImpl"/>
</bean>
<bean id="renditionEventProcessor" class="org.mockito.Mockito" factory-method="mock">
<constructor-arg value="org.alfresco.repo.rendition2.RenditionEventProcessor"/>
</bean>
<bean id="transformRequestProcessor" class="org.mockito.Mockito" factory-method="mock">
<constructor-arg value="org.alfresco.repo.rendition2.TransformRequestProcessor" />
</bean>
</beans>

View File

@@ -3,23 +3,23 @@
<beans>
<bean id="repositoryHelper" class="org.mockito.Mockito" factory-method="mock">
<constructor-arg type="java.lang.Class" value="org.alfresco.repo.model.Repository" />
<constructor-arg value="org.alfresco.repo.model.Repository" />
</bean>
<bean id="SiteService" class="org.mockito.Mockito" factory-method="mock">
<constructor-arg type="java.lang.Class" value="org.alfresco.repo.site.SiteServiceInternal" />
<constructor-arg value="org.alfresco.repo.site.SiteServiceInternal" />
</bean>
<bean id="NodeService" class="org.mockito.Mockito" factory-method="mock">
<constructor-arg type="java.lang.Class" value="org.alfresco.service.cmr.repository.NodeService" />
<constructor-arg value="org.alfresco.service.cmr.repository.NodeService" />
</bean>
<bean id="NamespaceService" class="org.mockito.Mockito" factory-method="mock">
<constructor-arg type="java.lang.Class" value="org.alfresco.service.namespace.NamespaceService" />
<constructor-arg value="org.alfresco.service.namespace.NamespaceService" />
</bean>
<bean id="SearchService" class="org.mockito.Mockito" factory-method="mock">
<constructor-arg type="java.lang.Class" value="org.alfresco.service.cmr.search.SearchService" />
<constructor-arg value="org.alfresco.service.cmr.search.SearchService" />
</bean>
</beans>