RM-1340: Couldn't cutoff closed folder

* includes a couple of fixes from the demo prep
  * override of MethodSecurityInterceptor to allow us to report detailed information when an AccessDenied exception is reported as the result of a capability evaluation failure.
  * integration tests



git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@69801 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Roy Wetherall
2014-05-08 06:01:02 +00:00
parent 70fe5509d8
commit e3ae5cd053
15 changed files with 571 additions and 301 deletions

View File

@@ -18,6 +18,7 @@
*/
package org.alfresco.module.org_alfresco_module_rm.test.integration;
import org.alfresco.module.org_alfresco_module_rm.test.integration.disposition.DispositionTestSuite;
import org.alfresco.module.org_alfresco_module_rm.test.integration.dod.DoD5015TestSuite;
import org.alfresco.module.org_alfresco_module_rm.test.integration.event.EventTestSuite;
import org.alfresco.module.org_alfresco_module_rm.test.integration.issue.IssueTestSuite;
@@ -39,7 +40,8 @@ import org.junit.runners.Suite.SuiteClasses;
DoD5015TestSuite.class,
IssueTestSuite.class,
EventTestSuite.class,
ReportTestSuite.class
ReportTestSuite.class,
DispositionTestSuite.class
})
public class IntegrationTestSuite
{

View File

@@ -0,0 +1,119 @@
/*
* Copyright (C) 2005-2014 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* 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/>.
*/
package org.alfresco.module.org_alfresco_module_rm.test.integration.disposition;
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.test.util.BaseRMTestCase;
import org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils;
import org.alfresco.service.cmr.repository.NodeRef;
import org.springframework.extensions.webscripts.GUID;
/**
* Cut off integration tests.
*
* @author Roy Wetherall
* @since 2.2
*/
public class CutOffTest extends BaseRMTestCase
{
/**
* given we have a record folder that is eligible for cutoff ensure that the
* record can be cut off successfully.
*/
public void testCutOffRecordFolder()
{
doBehaviourDrivenTest(new BehaviourDrivenTest()
{
NodeRef recordFolder = null;
public void given()
{
//create record folder
recordFolder = recordFolderService.createRecordFolder(rmContainer, GUID.generate());
// TODO add some records
// make eligible for cutoff
Map<String, Serializable> params = new HashMap<String, Serializable>(1);
params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME);
rmActionService.executeRecordsManagementAction(recordFolder, CompleteEventAction.NAME, params);
}
public void when()
{
// complete event
rmActionService.executeRecordsManagementAction(recordFolder, CutOffAction.NAME, null);
}
public void then()
{
// ensure the record folder is cut off
assertTrue(dispositionService.isDisposableItemCutoff(recordFolder));
}
});
}
/**
* given that we have a closed record folder eligible for cut off ensure that it can
* be cut off.
* <p>
* relates to https://issues.alfresco.com/jira/browse/RM-1340
*/
public void testCutOffClosedRecordFolder()
{
doBehaviourDrivenTest(new BehaviourDrivenTest()
{
NodeRef recordFolder = null;
public void given()
{
//create record folder
recordFolder = recordFolderService.createRecordFolder(rmContainer, GUID.generate());
// TODO add some records
// make eligible for cutoff
Map<String, Serializable> params = new HashMap<String, Serializable>(1);
params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME);
rmActionService.executeRecordsManagementAction(recordFolder, CompleteEventAction.NAME, params);
// close the record folder
recordFolderService.closeRecordFolder(recordFolder);
}
public void when()
{
// complete event
rmActionService.executeRecordsManagementAction(recordFolder, CutOffAction.NAME, null);
}
public void then()
{
// ensure the record folder is cut off
assertTrue(dispositionService.isDisposableItemCutoff(recordFolder));
}
});
}
}

View File

@@ -0,0 +1,38 @@
/*
* Copyright (C) 2005-2014 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* 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/>.
*/
package org.alfresco.module.org_alfresco_module_rm.test.integration.disposition;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
/**
* Disposition integration test suite
*
* @author Roy Wetherall
* @since 2.2
*/
@RunWith(Suite.class)
@SuiteClasses(
{
CutOffTest.class
})
public class DispositionTestSuite
{
}