mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-09-10 14:11:58 +00:00
Compare commits
37 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
4ef772560a | ||
|
2fa3aa5638 | ||
|
a63a232da2 | ||
|
8d1aeece29 | ||
|
c177a5ffee | ||
|
d28d4873be | ||
|
44d7c2328c | ||
|
073338afa7 | ||
|
3e53467ac8 | ||
|
0d5ffdac2e | ||
|
ac03eb7642 | ||
|
2ff5b7dd0a | ||
|
b0d7e6dfba | ||
|
3304a62a35 | ||
|
763591c1a3 | ||
|
6de5a507fe | ||
|
3990bc9db4 | ||
|
f2207fe43e | ||
|
f48db84334 | ||
|
98d73b7200 | ||
|
acd4b1efcb | ||
|
4433dd009a | ||
|
d1a9794ec8 | ||
|
bf848ff882 | ||
|
69ebccfc20 | ||
|
600b50fce1 | ||
|
37e8586658 | ||
|
4b12ed5a51 | ||
|
e379b7704d | ||
|
297be122a6 | ||
|
ca28024ad8 | ||
|
cfd3255aa7 | ||
|
4e436160cc | ||
|
bf0ca4ca83 | ||
|
e23a97960f | ||
|
2d2371a792 | ||
|
0ea69dd4ef |
@@ -157,10 +157,10 @@ jobs:
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.name=alfresco -Ddb.url=jdbc:mariadb://localhost:3307/alfresco?useUnicode=yes\&characterEncoding=UTF-8 -Ddb.username=alfresco -Ddb.password=alfresco -Ddb.driver=org.mariadb.jdbc.Driver
|
||||
|
||||
- name: "Repository - MySQL 5.7.23 tests"
|
||||
- name: "Repository - MySQL 5.7.28 tests"
|
||||
if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip db\]/ AND type != pull_request) OR commit_message =~ /\[db\]/
|
||||
before_script:
|
||||
- docker run -d -p 3307:3306 -e MYSQL_ROOT_PASSWORD=alfresco -e MYSQL_USER=alfresco -e MYSQL_DATABASE=alfresco -e MYSQL_PASSWORD=alfresco mysql:5.7.23 --transaction-isolation='READ-COMMITTED' --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
|
||||
- docker run -d -p 3307:3306 -e MYSQL_ROOT_PASSWORD=alfresco -e MYSQL_USER=alfresco -e MYSQL_DATABASE=alfresco -e MYSQL_PASSWORD=alfresco mysql:5.7.28 --transaction-isolation='READ-COMMITTED' --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.driver=com.mysql.jdbc.Driver -Ddb.name=alfresco -Ddb.url=jdbc:mysql://localhost:3307/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-amps</artifactId>
|
||||
<version>14.146-SNAPSHOT</version>
|
||||
<version>15.11</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-governance-services-community-parent</artifactId>
|
||||
<version>14.146-SNAPSHOT</version>
|
||||
<version>15.11</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-governance-services-automation-community-repo</artifactId>
|
||||
<version>14.146-SNAPSHOT</version>
|
||||
<version>15.11</version>
|
||||
</parent>
|
||||
|
||||
<build>
|
||||
|
@@ -102,7 +102,7 @@ public class DeleteRecordTests extends BaseRMRestTest
|
||||
testSite = dataSite.usingAdmin().createPublicRandomSite();
|
||||
recordFolder = createCategoryFolderInFilePlan();
|
||||
unfiledRecordFolder = createUnfiledContainerChild(UNFILED_RECORDS_CONTAINER_ALIAS, getRandomName("Unfiled Folder "),
|
||||
UNFILED_RECORD_FOLDER_TYPE);
|
||||
UNFILED_RECORD_FOLDER_TYPE);
|
||||
}
|
||||
|
||||
/** Data provider with electronic and non-electronic records to be deleted */
|
||||
@@ -133,10 +133,10 @@ public class DeleteRecordTests extends BaseRMRestTest
|
||||
* </pre>
|
||||
*/
|
||||
@Test
|
||||
(
|
||||
dataProvider = "recordsToBeDeleted",
|
||||
description = "Admin user can delete records"
|
||||
)
|
||||
(
|
||||
dataProvider = "recordsToBeDeleted",
|
||||
description = "Admin user can delete records"
|
||||
)
|
||||
@AlfrescoTest(jira="RM-4363")
|
||||
public void adminCanDeleteRecords(String recordId)
|
||||
{
|
||||
@@ -154,17 +154,17 @@ public class DeleteRecordTests extends BaseRMRestTest
|
||||
* </pre>
|
||||
*/
|
||||
@Test
|
||||
(
|
||||
description = "User without write permissions can't delete a record"
|
||||
)
|
||||
(
|
||||
description = "User without write permissions can't delete a record"
|
||||
)
|
||||
@AlfrescoTest(jira="RM-4363")
|
||||
public void userWithoutWritePermissionsCantDeleteRecord()
|
||||
{
|
||||
// Create a non-electronic record in unfiled records
|
||||
UnfiledContainerChild nonElectronicRecord = UnfiledContainerChild.builder()
|
||||
.name("Record " + RandomData.getRandomAlphanumeric())
|
||||
.nodeType(NON_ELECTRONIC_RECORD_TYPE)
|
||||
.build();
|
||||
.name("Record " + RandomData.getRandomAlphanumeric())
|
||||
.nodeType(NON_ELECTRONIC_RECORD_TYPE)
|
||||
.build();
|
||||
UnfiledContainerChild newRecord = getRestAPIFactory().getUnfiledContainersAPI().createUnfiledContainerChild(nonElectronicRecord, UNFILED_RECORDS_CONTAINER_ALIAS);
|
||||
|
||||
assertStatusCode(CREATED);
|
||||
@@ -187,9 +187,9 @@ public class DeleteRecordTests extends BaseRMRestTest
|
||||
* </pre>
|
||||
*/
|
||||
@Test
|
||||
(
|
||||
description = "User without delete records capability can't delete a record"
|
||||
)
|
||||
(
|
||||
description = "User without delete records capability can't delete a record"
|
||||
)
|
||||
@AlfrescoTest(jira="RM-4363")
|
||||
public void userWithoutDeleteRecordsCapabilityCantDeleteRecord()
|
||||
{
|
||||
@@ -234,7 +234,7 @@ public class DeleteRecordTests extends BaseRMRestTest
|
||||
|
||||
STEP("Create a record in first folder and copy it into second folder.");
|
||||
String recordId = getRestAPIFactory().getRecordFolderAPI()
|
||||
.createRecord(createElectronicRecordModel(), recordFolder.getId(), getFile(IMAGE_FILE)).getId();
|
||||
.createRecord(createElectronicRecordModel(), recordFolder.getId(), getFile(IMAGE_FILE)).getId();
|
||||
String copyId = copyNode(recordId, recordFolderB.getId()).getId();
|
||||
assertStatusCode(CREATED);
|
||||
|
||||
@@ -290,6 +290,7 @@ public class DeleteRecordTests extends BaseRMRestTest
|
||||
* Then it is still possible to view the content of the copy
|
||||
* </pre>
|
||||
*/
|
||||
/*
|
||||
@Test (description = "Destroying record doesn't delete the content for the associated copy")
|
||||
@AlfrescoTest (jira = "MNT-20145")
|
||||
public void destroyOfRecord()
|
||||
@@ -323,14 +324,15 @@ public class DeleteRecordTests extends BaseRMRestTest
|
||||
|
||||
STEP("Execute the disposition schedule steps.");
|
||||
rmRolesAndActionsAPI.executeAction(getAdminUser().getUsername(), getAdminUser().getUsername(), recordFiled.getName(),
|
||||
RM_ACTIONS.CUT_OFF);
|
||||
RM_ACTIONS.CUT_OFF);
|
||||
rmRolesAndActionsAPI.executeAction(getAdminUser().getUsername(), getAdminUser().getUsername(), recordFiled.getName(),
|
||||
RM_ACTIONS.DESTROY);
|
||||
RM_ACTIONS.DESTROY);
|
||||
|
||||
STEP("Check that it's possible to load the copy content.");
|
||||
getNodeContent(copy.getId());
|
||||
assertStatusCode(OK);
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
@@ -348,14 +350,14 @@ public class DeleteRecordTests extends BaseRMRestTest
|
||||
|
||||
STEP("Declare file version as record.");
|
||||
recordsAPI.declareDocumentVersionAsRecord(getAdminUser().getUsername(), getAdminUser().getPassword(), testSite.getId(),
|
||||
testFile.getName());
|
||||
testFile.getName());
|
||||
UnfiledContainerChild unfiledContainerChild = getRestAPIFactory().getUnfiledContainersAPI()
|
||||
.getUnfiledContainerChildren(UNFILED_RECORDS_CONTAINER_ALIAS)
|
||||
.getEntries().stream()
|
||||
.filter(child -> child.getEntry().getName()
|
||||
.startsWith(testFile.getName().substring(0, testFile.getName().indexOf("."))))
|
||||
.findFirst()
|
||||
.get().getEntry();
|
||||
.getUnfiledContainerChildren(UNFILED_RECORDS_CONTAINER_ALIAS)
|
||||
.getEntries().stream()
|
||||
.filter(child -> child.getEntry().getName()
|
||||
.startsWith(testFile.getName().substring(0, testFile.getName().indexOf("."))))
|
||||
.findFirst()
|
||||
.get().getEntry();
|
||||
|
||||
STEP("Delete the record.");
|
||||
deleteAndVerify(unfiledContainerChild.getId());
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-governance-services-community-parent</artifactId>
|
||||
<version>14.146-SNAPSHOT</version>
|
||||
<version>15.11</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -109,6 +109,10 @@ rm.completerecord.mandatorypropertiescheck.enabled=true
|
||||
#
|
||||
rm.patch.v22.convertToStandardFilePlan=false
|
||||
|
||||
#
|
||||
# Max Batch size for adding the associations between the frozen nodes and the hold
|
||||
rm.patch.v35.holdNewChildAssocPatch.batchSize=1000
|
||||
|
||||
# Permission mapping
|
||||
# these take a comma separated string of permissions from org.alfresco.service.cmr.security.PermissionService
|
||||
# read maps to ReadRecords and write to FileRecords
|
||||
|
@@ -17,5 +17,6 @@
|
||||
<property name="filePlanService" ref="filePlanService" />
|
||||
<property name="holdService" ref="holdService" />
|
||||
<property name="nodeService" ref="nodeService" />
|
||||
<property name="batchSize" value="${rm.patch.v35.holdNewChildAssocPatch.batchSize}" />
|
||||
</bean>
|
||||
</beans>
|
||||
|
@@ -8,7 +8,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-governance-services-community-repo-parent</artifactId>
|
||||
<version>14.146-SNAPSHOT</version>
|
||||
<version>15.11</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
@@ -30,6 +30,9 @@ import static org.alfresco.model.ContentModel.ASSOC_CONTAINS;
|
||||
import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementCustomModel.RM_CUSTOM_URI;
|
||||
import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.ASSOC_FROZEN_CONTENT;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
@@ -37,11 +40,14 @@ import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.hold.HoldService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch;
|
||||
import org.alfresco.repo.policy.BehaviourFilter;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
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.namespace.QName;
|
||||
import org.alfresco.service.namespace.RegexQNamePattern;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Patch to create new hold child association to link the record to the hold
|
||||
@@ -52,8 +58,15 @@ import org.alfresco.service.namespace.RegexQNamePattern;
|
||||
*/
|
||||
public class RMv35HoldNewChildAssocPatch extends AbstractModulePatch
|
||||
{
|
||||
/** logger */
|
||||
protected static final Logger LOGGER = LoggerFactory.getLogger(RMv35HoldNewChildAssocPatch.class);
|
||||
|
||||
/** A name for the associations created by this patch. */
|
||||
protected static final QName PATCH_ASSOC_NAME = QName.createQName(RM_CUSTOM_URI, RMv35HoldNewChildAssocPatch.class.getSimpleName());
|
||||
protected static final QName PATCH_ASSOC_NAME = QName.createQName(RM_CUSTOM_URI,
|
||||
RMv35HoldNewChildAssocPatch.class.getSimpleName());
|
||||
|
||||
/** The batch size for processing frozen nodes. */
|
||||
private int batchSize = 1000;
|
||||
|
||||
/**
|
||||
* File plan service interface
|
||||
@@ -75,7 +88,8 @@ public class RMv35HoldNewChildAssocPatch extends AbstractModulePatch
|
||||
/**
|
||||
* Setter for fileplanservice
|
||||
*
|
||||
* @param filePlanService File plan service interface
|
||||
* @param filePlanService
|
||||
* File plan service interface
|
||||
*/
|
||||
public void setFilePlanService(FilePlanService filePlanService)
|
||||
{
|
||||
@@ -85,7 +99,8 @@ public class RMv35HoldNewChildAssocPatch extends AbstractModulePatch
|
||||
/**
|
||||
* Setter for hold service
|
||||
*
|
||||
* @param holdService Hold service interface.
|
||||
* @param holdService
|
||||
* Hold service interface.
|
||||
*/
|
||||
public void setHoldService(HoldService holdService)
|
||||
{
|
||||
@@ -95,7 +110,8 @@ public class RMv35HoldNewChildAssocPatch extends AbstractModulePatch
|
||||
/**
|
||||
* Setter for node service
|
||||
*
|
||||
* @param nodeService Interface for public and internal node and store operations.
|
||||
* @param nodeService
|
||||
* Interface for public and internal node and store operations.
|
||||
*/
|
||||
public void setNodeService(NodeService nodeService)
|
||||
{
|
||||
@@ -112,33 +128,49 @@ public class RMv35HoldNewChildAssocPatch extends AbstractModulePatch
|
||||
this.behaviourFilter = behaviourFilter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for maximum batch size
|
||||
*
|
||||
* @param maxBatchSize
|
||||
* The max amount of associations to be created between the frozen nodes and the hold in a transaction
|
||||
*/
|
||||
public void setBatchSize(int batchSize)
|
||||
{
|
||||
this.batchSize = batchSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyInternal()
|
||||
{
|
||||
behaviourFilter.disableBehaviour(ContentModel.ASPECT_AUDITABLE);
|
||||
behaviourFilter.disableBehaviour(ContentModel.ASPECT_VERSIONABLE);
|
||||
|
||||
try
|
||||
{
|
||||
int patchedNodesCounter = 0;
|
||||
|
||||
for (NodeRef filePlan : filePlanService.getFilePlans())
|
||||
{
|
||||
for (NodeRef hold : holdService.getHolds(filePlan))
|
||||
{
|
||||
List<ChildAssociationRef> frozenAssoc = nodeService.getChildAssocs(hold, ASSOC_FROZEN_CONTENT, RegexQNamePattern.MATCH_ALL);
|
||||
for (ChildAssociationRef ref : frozenAssoc)
|
||||
LOGGER.debug("Analyzing hold {}", hold.getId());
|
||||
|
||||
BatchWorker batchWorker = new BatchWorker(hold);
|
||||
|
||||
LOGGER.debug("Hold has {} items to be analyzed", batchWorker.getWorkSize());
|
||||
|
||||
while (batchWorker.hasMoreResults())
|
||||
{
|
||||
NodeRef childNodeRef = ref.getChildRef();
|
||||
// In testing we found that this was returning more than just "contains" associations.
|
||||
// Possibly this is due to the code in Node2ServiceImpl.getParentAssocs not using the second parameter.
|
||||
List<ChildAssociationRef> parentAssocs = nodeService.getParentAssocs(childNodeRef, ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL);
|
||||
boolean childContainedByHold =
|
||||
parentAssocs.stream().anyMatch(entry -> entry.getParentRef().equals(hold) && entry.getTypeQName().equals(ASSOC_CONTAINS));
|
||||
if (!childContainedByHold)
|
||||
{
|
||||
nodeService.addChild(hold, childNodeRef, ASSOC_CONTAINS, PATCH_ASSOC_NAME);
|
||||
}
|
||||
processBatch(hold, batchWorker);
|
||||
}
|
||||
|
||||
LOGGER.debug("Patched {} items in hold", batchWorker.getTotalPatchedNodes());
|
||||
|
||||
patchedNodesCounter += batchWorker.getTotalPatchedNodes();
|
||||
}
|
||||
}
|
||||
|
||||
LOGGER.debug("Patch applied to {} children across all holds", patchedNodesCounter);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -146,4 +178,92 @@ public class RMv35HoldNewChildAssocPatch extends AbstractModulePatch
|
||||
behaviourFilter.enableBehaviour(ContentModel.ASPECT_VERSIONABLE);
|
||||
}
|
||||
}
|
||||
|
||||
private void processBatch(NodeRef hold, BatchWorker batch)
|
||||
{
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(() -> {
|
||||
|
||||
Collection<ChildAssociationRef> childRefs = batch.getNextWork();
|
||||
|
||||
LOGGER.debug("Processing batch of {} children in hold", childRefs.size());
|
||||
|
||||
for (ChildAssociationRef child : childRefs)
|
||||
{
|
||||
NodeRef childNodeRef = child.getChildRef();
|
||||
|
||||
if (!isChildContainedByHold(hold, childNodeRef))
|
||||
{
|
||||
nodeService.addChild(hold, childNodeRef, ASSOC_CONTAINS, PATCH_ASSOC_NAME);
|
||||
batch.countPatchedNode();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}, false, true);
|
||||
}
|
||||
|
||||
private boolean isChildContainedByHold(NodeRef hold, NodeRef child)
|
||||
{
|
||||
// In testing we found that this was returning more than just "contains" associations.
|
||||
// Possibly this is due to the code in Node2ServiceImpl.getParentAssocs not using the second
|
||||
// parameter.
|
||||
List<ChildAssociationRef> parentAssocs = nodeService.getParentAssocs(child, ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL);
|
||||
return parentAssocs.stream()
|
||||
.anyMatch(entry -> entry.getParentRef().equals(hold) && entry.getTypeQName().equals(ASSOC_CONTAINS));
|
||||
}
|
||||
|
||||
private class BatchWorker
|
||||
{
|
||||
NodeRef hold;
|
||||
int totalPatchedNodes = 0;
|
||||
int workSize;
|
||||
Iterator<ChildAssociationRef> iterator;
|
||||
|
||||
public BatchWorker(NodeRef hold)
|
||||
{
|
||||
this.hold = hold;
|
||||
setupHold();
|
||||
}
|
||||
|
||||
public boolean hasMoreResults()
|
||||
{
|
||||
return iterator == null ? true : iterator.hasNext();
|
||||
}
|
||||
|
||||
public void countPatchedNode()
|
||||
{
|
||||
this.totalPatchedNodes += 1;
|
||||
}
|
||||
|
||||
public int getTotalPatchedNodes()
|
||||
{
|
||||
return totalPatchedNodes;
|
||||
}
|
||||
|
||||
public int getWorkSize()
|
||||
{
|
||||
return workSize;
|
||||
}
|
||||
|
||||
public void setupHold()
|
||||
{
|
||||
// Get child assocs without preloading
|
||||
List<ChildAssociationRef> holdChildren = nodeService.getChildAssocs(hold, ASSOC_FROZEN_CONTENT,
|
||||
RegexQNamePattern.MATCH_ALL, Integer.MAX_VALUE, false);
|
||||
this.iterator = holdChildren.listIterator();
|
||||
this.workSize = holdChildren.size();
|
||||
}
|
||||
|
||||
public Collection<ChildAssociationRef> getNextWork()
|
||||
{
|
||||
List<ChildAssociationRef> frozenNodes = new ArrayList<ChildAssociationRef>(batchSize);
|
||||
while (iterator.hasNext() && frozenNodes.size() < batchSize)
|
||||
{
|
||||
frozenNodes.add(iterator.next());
|
||||
}
|
||||
return frozenNodes;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -4,8 +4,8 @@
|
||||
|
||||
# Version label
|
||||
version.major=7
|
||||
version.minor=0
|
||||
version.revision=0
|
||||
version.minor=2
|
||||
version.revision=1
|
||||
version.label=
|
||||
|
||||
# Edition label
|
||||
@@ -15,4 +15,4 @@ version.edition=Community
|
||||
version.scmrevision=@scm-path@-r@scm-revision@
|
||||
|
||||
# Build number
|
||||
version.build=r@scm-revision@-b@build-number@
|
||||
version.build=r@scm-revision@-b@build-number@
|
||||
|
@@ -33,8 +33,10 @@ import static java.util.Collections.emptyList;
|
||||
import static org.alfresco.model.ContentModel.ASSOC_CONTAINS;
|
||||
import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.ASSOC_FROZEN_CONTENT;
|
||||
import static org.alfresco.module.org_alfresco_module_rm.patch.v35.RMv35HoldNewChildAssocPatch.PATCH_ASSOC_NAME;
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Matchers.anyMap;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyBoolean;
|
||||
import static org.mockito.ArgumentMatchers.anyMap;
|
||||
import static org.mockito.Mockito.doAnswer;
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.times;
|
||||
@@ -51,16 +53,21 @@ import java.util.Set;
|
||||
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.hold.HoldService;
|
||||
import org.alfresco.repo.policy.BehaviourFilter;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
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.namespace.QName;
|
||||
import org.alfresco.service.namespace.RegexQNamePattern;
|
||||
import org.alfresco.service.transaction.TransactionService;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import org.mockito.invocation.InvocationOnMock;
|
||||
import org.mockito.stubbing.Answer;
|
||||
|
||||
/**
|
||||
* RM V3.5 Create new hold child association to link the record to the hold
|
||||
@@ -81,6 +88,12 @@ public class RMv35HoldNewChildAssocPatchUnitTest
|
||||
@Mock
|
||||
private BehaviourFilter mockBehaviourFilter;
|
||||
|
||||
@Mock
|
||||
private TransactionService mockTransactionService;
|
||||
|
||||
@Mock
|
||||
private RetryingTransactionHelper mockRetryingTransactionHelper;
|
||||
|
||||
@InjectMocks
|
||||
private RMv35HoldNewChildAssocPatch patch;
|
||||
|
||||
@@ -112,25 +125,63 @@ public class RMv35HoldNewChildAssocPatchUnitTest
|
||||
/**
|
||||
* Test secondary associations are created for held items so that they are "contained" in the hold.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testAddChildDuringUpgrade()
|
||||
{
|
||||
when(mockFilePlanService.getFilePlans()).thenReturn(fileplans);
|
||||
when(mockHoldService.getHolds(filePlanRef)).thenReturn(holds);
|
||||
when(mockNodeService.getChildAssocs(holdRef, ASSOC_FROZEN_CONTENT, RegexQNamePattern.MATCH_ALL)).thenReturn(childAssocs);
|
||||
when(mockNodeService.getChildAssocs(holdRef, ASSOC_FROZEN_CONTENT, RegexQNamePattern.MATCH_ALL, Integer.MAX_VALUE, false))
|
||||
.thenReturn(childAssocs);
|
||||
when(childAssociationRef.getChildRef()).thenReturn(heldItemRef);
|
||||
|
||||
// setup retrying transaction helper
|
||||
Answer<Object> doInTransactionAnswer = new Answer<Object>()
|
||||
{
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
public Object answer(InvocationOnMock invocation) throws Throwable
|
||||
{
|
||||
RetryingTransactionCallback callback = (RetryingTransactionCallback) invocation.getArguments()[0];
|
||||
// when(childAssociationRef.getChildRef()).thenReturn(heldItemRef);
|
||||
return callback.execute();
|
||||
}
|
||||
};
|
||||
doAnswer(doInTransactionAnswer).when(mockRetryingTransactionHelper)
|
||||
.<Object> doInTransaction(any(RetryingTransactionCallback.class), anyBoolean(), anyBoolean());
|
||||
|
||||
when(mockTransactionService.getRetryingTransactionHelper()).thenReturn(mockRetryingTransactionHelper);
|
||||
|
||||
patch.applyInternal();
|
||||
|
||||
verify(mockNodeService, times(1)).addChild(holdRef, heldItemRef, ASSOC_CONTAINS, PATCH_ASSOC_NAME);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void patchRunWithSuccessWhenNoHeldChildren()
|
||||
{
|
||||
when(mockFilePlanService.getFilePlans()).thenReturn(fileplans);
|
||||
when(mockHoldService.getHolds(filePlanRef)).thenReturn(holds);
|
||||
when(mockNodeService.getChildAssocs(holdRef, ASSOC_FROZEN_CONTENT, RegexQNamePattern.MATCH_ALL)).thenReturn(emptyList());
|
||||
when(mockNodeService.getChildAssocs(holdRef, ASSOC_FROZEN_CONTENT, RegexQNamePattern.MATCH_ALL, Integer.MAX_VALUE, false))
|
||||
.thenReturn(emptyList());
|
||||
|
||||
// setup retrying transaction helper
|
||||
Answer<Object> doInTransactionAnswer = new Answer<Object>()
|
||||
{
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
public Object answer(InvocationOnMock invocation) throws Throwable
|
||||
{
|
||||
RetryingTransactionCallback callback = (RetryingTransactionCallback) invocation.getArguments()[0];
|
||||
when(childAssociationRef.getChildRef()).thenReturn(heldItemRef);
|
||||
return callback.execute();
|
||||
}
|
||||
};
|
||||
doAnswer(doInTransactionAnswer).when(mockRetryingTransactionHelper)
|
||||
.<Object> doInTransaction(any(RetryingTransactionCallback.class), anyBoolean(), anyBoolean());
|
||||
|
||||
when(mockTransactionService.getRetryingTransactionHelper()).thenReturn(mockRetryingTransactionHelper);
|
||||
|
||||
patch.applyInternal();
|
||||
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-governance-services-community-repo-parent</artifactId>
|
||||
<version>14.146-SNAPSHOT</version>
|
||||
<version>15.11</version>
|
||||
</parent>
|
||||
|
||||
<build>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.146-SNAPSHOT</version>
|
||||
<version>15.11</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -8,7 +8,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-amps</artifactId>
|
||||
<version>14.146-SNAPSHOT</version>
|
||||
<version>15.11</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
@@ -176,7 +176,6 @@ public class NodeBrowserScript extends NodeBrowserPost implements Serializable
|
||||
{
|
||||
status.setCode(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
|
||||
status.setMessage(e.getMessage());
|
||||
status.setException(e);
|
||||
status.setRedirect(true);
|
||||
}
|
||||
return tmplMap;
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.146-SNAPSHOT</version>
|
||||
<version>15.11</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.146-SNAPSHOT</version>
|
||||
<version>15.11</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.146-SNAPSHOT</version>
|
||||
<version>15.11</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
@@ -9,6 +9,6 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||
<version>14.146-SNAPSHOT</version>
|
||||
<version>15.11</version>
|
||||
</parent>
|
||||
</project>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||
<version>14.146-SNAPSHOT</version>
|
||||
<version>15.11</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.146-SNAPSHOT</version>
|
||||
<version>15.11</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||
<version>14.146-SNAPSHOT</version>
|
||||
<version>15.11</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>14.146-SNAPSHOT</version>
|
||||
<version>15.11</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>14.146-SNAPSHOT</version>
|
||||
<version>15.11</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>14.146-SNAPSHOT</version>
|
||||
<version>15.11</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>14.146-SNAPSHOT</version>
|
||||
<version>15.11</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -16,7 +16,7 @@ import org.testng.annotations.Test;
|
||||
*/
|
||||
public class GetProcessSanityTests extends RestTest
|
||||
{
|
||||
private UserModel userWhoStartsProcess, assignee;
|
||||
private UserModel userWhoStartsProcess, assignee, user;
|
||||
private RestProcessModel addedProcess, process;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
@@ -24,6 +24,7 @@ public class GetProcessSanityTests extends RestTest
|
||||
{
|
||||
userWhoStartsProcess = dataUser.createRandomTestUser();
|
||||
assignee = dataUser.createRandomTestUser();
|
||||
user = dataUser.createRandomTestUser();
|
||||
addedProcess = restClient.authenticateUser(userWhoStartsProcess).withWorkflowAPI().addProcess("activitiAdhoc", assignee, false, CMISUtil.Priority.High);
|
||||
}
|
||||
|
||||
@@ -59,4 +60,13 @@ public class GetProcessSanityTests extends RestTest
|
||||
process.assertThat().field("id").is(addedProcess.getId())
|
||||
.and().field("startUserId").is(addedProcess.getStartUserId());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PROCESSES }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify User that is not involved in a process cannot get that process using REST API and status code is FORBIDDEN (403)")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES, TestGroup.SANITY })
|
||||
public void shouldNotGetProcessesByNotInvolvedUser() throws Exception
|
||||
{
|
||||
process = restClient.authenticateUser(user).withWorkflowAPI().usingProcess(addedProcess).getProcess();
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN);
|
||||
}
|
||||
}
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>14.146-SNAPSHOT</version>
|
||||
<version>15.11</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||
<version>14.146-SNAPSHOT</version>
|
||||
<version>15.11</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
18
pom.xml
18
pom.xml
@@ -2,7 +2,7 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.146-SNAPSHOT</version>
|
||||
<version>15.11</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>Alfresco Community Repo Parent</name>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<properties>
|
||||
<acs.version.major>7</acs.version.major>
|
||||
<acs.version.minor>2</acs.version.minor>
|
||||
<acs.version.revision>0</acs.version.revision>
|
||||
<acs.version.revision>1</acs.version.revision>
|
||||
<acs.version.label />
|
||||
<amp.min.version>${acs.version.major}.0.0</amp.min.version>
|
||||
|
||||
@@ -55,19 +55,19 @@
|
||||
<dependency.alfresco-greenmail.version>6.2</dependency.alfresco-greenmail.version>
|
||||
<dependency.acs-event-model.version>0.0.13</dependency.acs-event-model.version>
|
||||
|
||||
<dependency.spring.version>5.3.15</dependency.spring.version>
|
||||
<dependency.spring.version>5.3.18</dependency.spring.version>
|
||||
<dependency.antlr.version>3.5.2</dependency.antlr.version>
|
||||
<dependency.jackson.version>2.13.1</dependency.jackson.version>
|
||||
<dependency.jackson-databind.version>2.13.1</dependency.jackson-databind.version>
|
||||
<dependency.jackson.version>2.13.3</dependency.jackson.version>
|
||||
<dependency.jackson-databind.version>2.13.3</dependency.jackson-databind.version>
|
||||
<dependency.cxf.version>3.5.0</dependency.cxf.version>
|
||||
<dependency.opencmis.version>1.0.0</dependency.opencmis.version>
|
||||
<dependency.webscripts.version>8.28</dependency.webscripts.version>
|
||||
<dependency.webscripts.version>8.31</dependency.webscripts.version>
|
||||
<dependency.bouncycastle.version>1.70</dependency.bouncycastle.version>
|
||||
<dependency.mockito-core.version>3.11.2</dependency.mockito-core.version>
|
||||
<dependency.org-json.version>20211205</dependency.org-json.version>
|
||||
<dependency.commons-dbcp.version>2.9.0</dependency.commons-dbcp.version>
|
||||
<dependency.commons-io.version>2.11.0</dependency.commons-io.version>
|
||||
<dependency.gson.version>2.8.5</dependency.gson.version>
|
||||
<dependency.gson.version>2.8.9</dependency.gson.version>
|
||||
<dependency.httpclient.version>4.5.13</dependency.httpclient.version>
|
||||
<dependency.httpcore.version>4.4.15</dependency.httpcore.version>
|
||||
<dependency.commons-httpclient.version>3.1-HTTPCLIENT-1265</dependency.commons-httpclient.version>
|
||||
@@ -107,7 +107,7 @@
|
||||
|
||||
<alfresco.googledrive.version>3.2.1.3</alfresco.googledrive.version>
|
||||
<alfresco.aos-module.version>1.4.1</alfresco.aos-module.version>
|
||||
<alfresco.api-explorer.version>7.2.0</alfresco.api-explorer.version> <!-- Also in alfresco-enterprise-share -->
|
||||
<alfresco.api-explorer.version>7.2.1</alfresco.api-explorer.version> <!-- Also in alfresco-enterprise-share -->
|
||||
|
||||
<alfresco.maven-plugin.version>2.2.0</alfresco.maven-plugin.version>
|
||||
<license-maven-plugin.version>2.0.1.alfresco-2</license-maven-plugin.version>
|
||||
@@ -146,7 +146,7 @@
|
||||
<connection>scm:git:https://github.com/Alfresco/alfresco-community-repo.git</connection>
|
||||
<developerConnection>scm:git:https://github.com/Alfresco/alfresco-community-repo.git</developerConnection>
|
||||
<url>https://github.com/Alfresco/alfresco-community-repo</url>
|
||||
<tag>HEAD</tag>
|
||||
<tag>15.11</tag>
|
||||
</scm>
|
||||
|
||||
<distributionManagement>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.146-SNAPSHOT</version>
|
||||
<version>15.11</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
@@ -511,7 +511,9 @@ public class ProcessesImpl extends WorkflowRestImpl implements Processes
|
||||
{
|
||||
throw new InvalidArgumentException("processId is required to get the process info");
|
||||
}
|
||||
|
||||
|
||||
validateIfUserAllowedToWorkWithProcess(processId);
|
||||
|
||||
HistoricProcessInstance processInstance = activitiProcessEngine
|
||||
.getHistoryService()
|
||||
.createHistoricProcessInstanceQuery()
|
||||
|
@@ -3,6 +3,7 @@ function main()
|
||||
|
||||
// Get the args
|
||||
var filter = args["filter"];
|
||||
if (filter!==null && !filter.includes(":")) {filter += " [hint:useCQ]";}
|
||||
var maxResults = args["maxResults"];
|
||||
var skipCountStr = args["skipCount"];
|
||||
var skipCount = skipCountStr != null ? parseInt(skipCountStr) : -1;
|
||||
|
@@ -3,7 +3,7 @@ function main()
|
||||
// Get the args
|
||||
var siteShortName = url.templateArgs.shortname,
|
||||
site = siteService.getSite(siteShortName),
|
||||
filter = (args.filter != null) ? args.filter : (args.shortNameFilter != null) ? args.shortNameFilter : "",
|
||||
filter = ((args.filter != null) ? args.filter : (args.shortNameFilter != null) ? args.shortNameFilter : "" )+ " [hint:useCQ]",
|
||||
maxResults = (args.maxResults == null) ? 10 : parseInt(args.maxResults, 10),
|
||||
authorityType = args.authorityType,
|
||||
zone = args.zone,
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.146-SNAPSHOT</version>
|
||||
<version>15.11</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
@@ -236,7 +236,7 @@
|
||||
<dependency>
|
||||
<groupId>org.freemarker</groupId>
|
||||
<artifactId>freemarker</artifactId>
|
||||
<version>2.3.20-alfresco-patched-20200421</version>
|
||||
<version>2.3.20-alfresco-patched-20220413</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.xmlbeans</groupId>
|
||||
|
@@ -3,7 +3,7 @@
|
||||
repository.name=Main Repository
|
||||
|
||||
# Schema number
|
||||
version.schema=16000
|
||||
version.schema=16100
|
||||
|
||||
# Directory configuration
|
||||
|
||||
|
Reference in New Issue
Block a user