mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-2925 - made Delete action available for destroyed record folder, added unit test class
This commit is contained in:
@@ -112,9 +112,10 @@
|
|||||||
<property name="conditions">
|
<property name="conditions">
|
||||||
<map>
|
<map>
|
||||||
<entry key="capabilityCondition.filling" value="true"/>
|
<entry key="capabilityCondition.filling" value="true"/>
|
||||||
<entry key="capabilityCondition.cutoff" value="false"/>
|
|
||||||
<entry key="capabilityCondition.frozen" value="false"/>
|
<entry key="capabilityCondition.frozen" value="false"/>
|
||||||
|
<!-- <entry key="capabilityCondition.cutoff" value="false"/>
|
||||||
<entry key="capabilityCondition.closed" value="false"/>
|
<entry key="capabilityCondition.closed" value="false"/>
|
||||||
|
-->
|
||||||
</map>
|
</map>
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
@@ -129,6 +130,12 @@
|
|||||||
<ref bean="rmDeleteRecordFolderCapability"/>
|
<ref bean="rmDeleteRecordFolderCapability"/>
|
||||||
</list>
|
</list>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="conditions">
|
||||||
|
<map>
|
||||||
|
<entry key="capabilityCondition.cutoff" value="false"/>
|
||||||
|
<entry key="capabilityCondition.closed" value="false"/>
|
||||||
|
</map>
|
||||||
|
</property>
|
||||||
<property name="targetCapability" ref="rmCreateRecordFolderCapability"/>
|
<property name="targetCapability" ref="rmCreateRecordFolderCapability"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
@@ -0,0 +1,97 @@
|
|||||||
|
/*
|
||||||
|
* #%L
|
||||||
|
* Alfresco Records Management Module
|
||||||
|
* %%
|
||||||
|
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||||
|
* %%
|
||||||
|
* This file is part of the Alfresco software.
|
||||||
|
* -
|
||||||
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
|
* provided under the following open source license terms:
|
||||||
|
* -
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
* -
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
* -
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* #L%
|
||||||
|
*/
|
||||||
|
package org.alfresco.module.org_alfresco_module_rm.test.integration.recordfolder;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.action.impl.CompleteEventAction;
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.action.impl.CutOffAction;
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.action.impl.DestroyAction;
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.capability.Capability;
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils;
|
||||||
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
|
||||||
|
import net.sf.acegisecurity.vote.AccessDecisionVoter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete record folder test.
|
||||||
|
*
|
||||||
|
* @author Roxana Lucanu
|
||||||
|
* @since 2.4
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class DeleteRecordFolderTest extends BaseRMTestCase {
|
||||||
|
|
||||||
|
// delete a destroyed record folder
|
||||||
|
public void testDeleteDestroyedRecordFolder() throws Exception
|
||||||
|
{
|
||||||
|
|
||||||
|
final NodeRef testFolder = doTestInTransaction(new Test<NodeRef>()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public NodeRef run()
|
||||||
|
{
|
||||||
|
// create folder
|
||||||
|
NodeRef testFolder = recordFolderService.createRecordFolder(rmContainer, "Peter Edward Francis");
|
||||||
|
|
||||||
|
// complete event
|
||||||
|
Map<String, Serializable> params = new HashMap<String, Serializable>(1);
|
||||||
|
params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME);
|
||||||
|
rmActionService.executeRecordsManagementAction(testFolder, CompleteEventAction.NAME, params);
|
||||||
|
|
||||||
|
// cutoff folder
|
||||||
|
rmActionService.executeRecordsManagementAction(testFolder, CutOffAction.NAME);
|
||||||
|
|
||||||
|
// destroy folder
|
||||||
|
rmActionService.executeRecordsManagementAction(testFolder, DestroyAction.NAME);
|
||||||
|
|
||||||
|
return testFolder;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void test(NodeRef testFolder) throws Exception
|
||||||
|
{
|
||||||
|
// take a look at delete capability
|
||||||
|
Capability deleteCapability = capabilityService.getCapability("DeleteRecordFolder");
|
||||||
|
assertEquals(AccessDecisionVoter.ACCESS_GRANTED, deleteCapability.evaluate(testFolder));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
doTestInTransaction(new FailureTest()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run() throws Exception
|
||||||
|
{
|
||||||
|
fileFolderService.delete(testFolder);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -431,7 +431,7 @@ public class MoveRecordFolderTest extends BaseRMTestCase
|
|||||||
public void test(NodeRef testFolder) throws Exception
|
public void test(NodeRef testFolder) throws Exception
|
||||||
{
|
{
|
||||||
// take a look at the move capability
|
// take a look at the move capability
|
||||||
Capability moveCapability = capabilityService.getCapability("Move");
|
Capability moveCapability = capabilityService.getCapability("MoveRecordFolder");
|
||||||
assertEquals(AccessDecisionVoter.ACCESS_DENIED, moveCapability.evaluate(testFolder, destination));
|
assertEquals(AccessDecisionVoter.ACCESS_DENIED, moveCapability.evaluate(testFolder, destination));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user