mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-2697 Move DoD tests to Enterprise.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@118835 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1,176 +0,0 @@
|
||||
/*
|
||||
* 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.dod;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model;
|
||||
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind;
|
||||
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.site.SiteInfo;
|
||||
import org.alfresco.service.cmr.site.SiteVisibility;
|
||||
import org.alfresco.util.GUID;
|
||||
|
||||
|
||||
/**
|
||||
* Integration test for RM1147 - A user can create a 'vanilla' or DOD compliant records management site.
|
||||
*
|
||||
* @author Roy Wetherall
|
||||
* @since 2.2
|
||||
*/
|
||||
public class RM1147DODRMSiteTest extends BaseRMTestCase implements DOD5015Model
|
||||
{
|
||||
/**
|
||||
* Don't create a RM test site in setup
|
||||
*/
|
||||
@Override
|
||||
protected boolean isRMSiteTest()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the creation of a DOD file plan via the file plan service
|
||||
*/
|
||||
public void testCreateDODFilePlan()
|
||||
{
|
||||
doTestInTransaction(new Test<NodeRef>()
|
||||
{
|
||||
@Override
|
||||
public NodeRef run() throws Exception
|
||||
{
|
||||
return filePlanService.createFilePlan(folder, "myDODfileplan", TYPE_DOD_5015_FILE_PLAN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void test(NodeRef filePlan) throws Exception
|
||||
{
|
||||
assertNotNull(filePlan);
|
||||
assertEquals(TYPE_DOD_5015_FILE_PLAN, nodeService.getType(filePlan));
|
||||
assertTrue(filePlanService.isFilePlanComponent(filePlan));
|
||||
assertTrue(filePlanService.isFilePlan(filePlan));
|
||||
assertEquals(FilePlanComponentKind.FILE_PLAN, filePlanService.getFilePlanComponentKind(filePlan));
|
||||
assertNotNull(filePlanService.getUnfiledContainer(filePlan));
|
||||
assertNotNull(filePlanService.getHoldContainer(filePlan));
|
||||
assertNotNull(filePlanService.getTransferContainer(filePlan));
|
||||
assertTrue(filePlanService.getFilePlans().contains(filePlan));
|
||||
assertFalse(filePlanRoleService.getRoles(filePlan).isEmpty());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the creation of a DOD site via the site service
|
||||
*/
|
||||
public void testCreateDODRMSite()
|
||||
{
|
||||
doTestInTransaction(new Test<SiteInfo>()
|
||||
{
|
||||
String siteId = GUID.generate();
|
||||
|
||||
@Override
|
||||
public SiteInfo run() throws Exception
|
||||
{
|
||||
return siteService.createSite("dodrmsite", siteId, "title", "description", SiteVisibility.PUBLIC, TYPE_DOD_5015_SITE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void test(SiteInfo siteInfo) throws Exception
|
||||
{
|
||||
assertNotNull(siteInfo);
|
||||
assertEquals(TYPE_DOD_5015_SITE, nodeService.getType(siteInfo.getNodeRef()));
|
||||
|
||||
NodeRef filePlan = siteService.getContainer(siteId, "documentLibrary");
|
||||
assertNotNull(filePlan);
|
||||
assertEquals(TYPE_DOD_5015_FILE_PLAN, nodeService.getType(filePlan));
|
||||
assertTrue(filePlanService.isFilePlanComponent(filePlan));
|
||||
assertTrue(filePlanService.isFilePlan(filePlan));
|
||||
assertEquals(FilePlanComponentKind.FILE_PLAN, filePlanService.getFilePlanComponentKind(filePlan));
|
||||
assertNotNull(filePlanService.getUnfiledContainer(filePlan));
|
||||
assertNotNull(filePlanService.getHoldContainer(filePlan));
|
||||
assertNotNull(filePlanService.getTransferContainer(filePlan));
|
||||
assertTrue(filePlanService.getFilePlans().contains(filePlan));
|
||||
assertFalse(filePlanRoleService.getRoles(filePlan).isEmpty());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Test to ensure that a record created in the a DOD site does have the DOD meta-data attached
|
||||
*/
|
||||
public void testDODRecord()
|
||||
{
|
||||
doTestInTransaction(new Test<NodeRef>()
|
||||
{
|
||||
String siteId = GUID.generate();
|
||||
|
||||
@Override
|
||||
public NodeRef run() throws Exception
|
||||
{
|
||||
siteService.createSite("dodrmsite", siteId, "title", "description", SiteVisibility.PUBLIC, TYPE_DOD_5015_SITE);
|
||||
NodeRef filePlan = siteService.getContainer(siteId, "documentlibrary");
|
||||
assertNotNull(filePlan);
|
||||
|
||||
NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, "testOne");
|
||||
NodeRef recordFolder = recordFolderService.createRecordFolder(recordCategory, "testOne");
|
||||
NodeRef record = utils.createRecord(recordFolder, "testOne.txt", "Test One");
|
||||
|
||||
return record;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void test(NodeRef record) throws Exception
|
||||
{
|
||||
assertNotNull(record);
|
||||
assertTrue(nodeService.hasAspect(record, ASPECT_DOD_5015_RECORD));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Test to ensure a record created in a vanilla site does not have the DOD meta-data attached
|
||||
*/
|
||||
public void testVanillaRecord()
|
||||
{
|
||||
doTestInTransaction(new Test<NodeRef>()
|
||||
{
|
||||
String siteId = GUID.generate();
|
||||
|
||||
@Override
|
||||
public NodeRef run() throws Exception
|
||||
{
|
||||
siteService.createSite("rmsite", siteId, "title", "description", SiteVisibility.PUBLIC, TYPE_RM_SITE);
|
||||
NodeRef filePlan = siteService.getContainer(siteId, "documentlibrary");
|
||||
assertNotNull(filePlan);
|
||||
|
||||
NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, "testOne");
|
||||
NodeRef recordFolder = recordFolderService.createRecordFolder(recordCategory, "testOne");
|
||||
NodeRef record = utils.createRecord(recordFolder, "testOne.txt", "Test One");
|
||||
|
||||
return record;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void test(NodeRef record) throws Exception
|
||||
{
|
||||
assertNotNull(record);
|
||||
assertFalse(nodeService.hasAspect(record, ASPECT_DOD_5015_RECORD));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@@ -1,115 +0,0 @@
|
||||
/*
|
||||
* 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.dod;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model;
|
||||
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.site.SiteVisibility;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.util.GUID;
|
||||
|
||||
|
||||
/**
|
||||
* Integration test for RM1147 - A user can create a 'vanilla' or DOD compliant records management site.
|
||||
*
|
||||
* @author Roy Wetherall
|
||||
* @since 2.2
|
||||
*/
|
||||
public class RM1194ExcludeDoDRecordTypesTest extends BaseRMTestCase implements DOD5015Model
|
||||
{
|
||||
/**
|
||||
* Don't create a RM test site in setup
|
||||
*/
|
||||
@Override
|
||||
protected boolean isRMSiteTest()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure that the correct record metadata aspects are available for a DoD record.
|
||||
*/
|
||||
public void testDODRecord()
|
||||
{
|
||||
doTestInTransaction(new Test<NodeRef>()
|
||||
{
|
||||
String siteId = GUID.generate();
|
||||
|
||||
@Override
|
||||
public NodeRef run() throws Exception
|
||||
{
|
||||
siteService.createSite("dodrmsite", siteId, "title", "description", SiteVisibility.PUBLIC, TYPE_DOD_5015_SITE);
|
||||
NodeRef filePlan = siteService.getContainer(siteId, "documentlibrary");
|
||||
assertNotNull(filePlan);
|
||||
|
||||
NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, "testOne");
|
||||
NodeRef recordFolder = recordFolderService.createRecordFolder(recordCategory, "testOne");
|
||||
NodeRef record = utils.createRecord(recordFolder, "testOne.txt", "Test One");
|
||||
|
||||
return record;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void test(NodeRef record) throws Exception
|
||||
{
|
||||
assertNotNull(record);
|
||||
Set<QName> aspects = recordService.getRecordMetadataAspects(record);
|
||||
assertNotNull(aspects);
|
||||
assertEquals(5, aspects.size());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure that the correct record metadata aspects are available for a vanilla record.
|
||||
*/
|
||||
public void testVanillaRecord()
|
||||
{
|
||||
doTestInTransaction(new Test<NodeRef>()
|
||||
{
|
||||
String siteId = GUID.generate();
|
||||
|
||||
@Override
|
||||
public NodeRef run() throws Exception
|
||||
{
|
||||
siteService.createSite("rmsite", siteId, "title", "description", SiteVisibility.PUBLIC, TYPE_RM_SITE);
|
||||
NodeRef filePlan = siteService.getContainer(siteId, "documentlibrary");
|
||||
assertNotNull(filePlan);
|
||||
|
||||
NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, "testOne");
|
||||
NodeRef recordFolder = recordFolderService.createRecordFolder(recordCategory, "testOne");
|
||||
NodeRef record = utils.createRecord(recordFolder, "testOne.txt", "Test One");
|
||||
|
||||
return record;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void test(NodeRef record) throws Exception
|
||||
{
|
||||
assertNotNull(record);
|
||||
Set<QName> aspects = recordService.getRecordMetadataAspects(record);
|
||||
assertNotNull(aspects);
|
||||
assertEquals(2, aspects.size());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@@ -40,7 +40,7 @@ import org.alfresco.service.cmr.repository.NodeRef;
|
||||
public class DataSetServiceImplTest extends BaseRMTestCase
|
||||
{
|
||||
/** Id of the test data set*/
|
||||
private static final String DATA_SET_ID = "testExampleData";
|
||||
private static final String DATA_SET_ID = "testExampleData";
|
||||
|
||||
/**
|
||||
* @see DataSetService#getDataSets()
|
||||
@@ -211,7 +211,7 @@ public class DataSetServiceImplTest extends BaseRMTestCase
|
||||
DispositionSchedule recCat22DispositionSchedule = dispositionService.getDispositionSchedule(recCat22);
|
||||
assertNotNull(recCat22DispositionSchedule);
|
||||
|
||||
// After loading the data set into the file plan the custom aspect should contain the id of the loaded data set
|
||||
// After loading the data set into the file plan the custom aspect should contain the id of the loaded data set
|
||||
Serializable nodeProperty = nodeService.getProperty(filePlan, PROP_LOADED_DATA_SET_IDS);
|
||||
assertNotNull(nodeProperty);
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -224,8 +224,9 @@ public class DataSetServiceImplTest extends BaseRMTestCase
|
||||
assertTrue(loadedDataSets.size() == 1);
|
||||
assertTrue(loadedDataSets.containsKey(DATA_SET_ID));
|
||||
assertTrue(dataSetService.isLoadedDataSet(filePlan, DATA_SET_ID));
|
||||
assertTrue(dataSetService.getDataSets(filePlan, true).size() > 0);
|
||||
assertTrue(dataSetService.getDataSets(filePlan, false).size() > 1);
|
||||
// TODO Evaluate the necessity of the next assertion.
|
||||
// assertTrue(dataSetService.getDataSets(filePlan, true).size() > 0);
|
||||
assertTrue(dataSetService.getDataSets(filePlan, false).size() > 0);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@@ -22,7 +22,6 @@ import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@@ -34,7 +33,6 @@ import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionD
|
||||
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule;
|
||||
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.disposition.property.DispositionProperty;
|
||||
import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model;
|
||||
import org.alfresco.module.org_alfresco_module_rm.event.EventCompletionDetails;
|
||||
import org.alfresco.module.org_alfresco_module_rm.job.PublishUpdatesJobExecuter;
|
||||
import org.alfresco.module.org_alfresco_module_rm.job.publish.PublishExecutor;
|
||||
@@ -67,7 +65,7 @@ public class DispositionServiceImplTest extends BaseRMTestCase
|
||||
Collection<DispositionProperty> properties = dispositionService.getDispositionProperties();
|
||||
|
||||
assertNotNull(properties);
|
||||
assertEquals(5, properties.size());
|
||||
assertEquals(4, properties.size());
|
||||
|
||||
for (DispositionProperty property : properties)
|
||||
{
|
||||
@@ -826,80 +824,6 @@ public class DispositionServiceImplTest extends BaseRMTestCase
|
||||
|
||||
/* === Issues === */
|
||||
|
||||
private NodeRef testRM263RecordCategory;
|
||||
private DispositionSchedule testRM263DispositionSchedule;
|
||||
private NodeRef testRM263Record;
|
||||
|
||||
/**
|
||||
* https://issues.alfresco.com/jira/browse/RM-263
|
||||
*/
|
||||
public void testRM_263() throws Exception
|
||||
{
|
||||
doTestInTransaction(new Test<Void>()
|
||||
{
|
||||
@Override
|
||||
public Void run() throws Exception
|
||||
{
|
||||
testRM263RecordCategory = filePlanService.createRecordCategory(rmContainer, "rm263");
|
||||
testRM263DispositionSchedule = utils.createBasicDispositionSchedule(
|
||||
testRM263RecordCategory,
|
||||
"test",
|
||||
"test",
|
||||
true,
|
||||
false);
|
||||
|
||||
Map<QName, Serializable> adParams = new HashMap<QName, Serializable>(3);
|
||||
adParams.put(PROP_DISPOSITION_ACTION_NAME, "cutoff");
|
||||
adParams.put(PROP_DISPOSITION_DESCRIPTION, "test");
|
||||
adParams.put(PROP_DISPOSITION_PERIOD, "week|1");
|
||||
adParams.put(PROP_DISPOSITION_PERIOD_PROPERTY, DOD5015Model.PROP_PUBLICATION_DATE.toString());
|
||||
|
||||
dispositionService.addDispositionActionDefinition(testRM263DispositionSchedule, adParams);
|
||||
|
||||
NodeRef recordFolder = recordFolderService.createRecordFolder(testRM263RecordCategory, "testRM263RecordFolder");
|
||||
testRM263Record = utils.createRecord(recordFolder, "testRM263Record", "testRM263Record");
|
||||
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
doTestInTransaction(new Test<Void>()
|
||||
{
|
||||
private final QName PROP_SEARCH_ASOF = QName.createQName(RM_URI, "recordSearchDispositionActionAsOf");
|
||||
|
||||
@Override
|
||||
public Void run() throws Exception
|
||||
{
|
||||
Date pubDate = (Date)nodeService.getProperty(testRM263Record, DOD5015Model.PROP_PUBLICATION_DATE);
|
||||
assertNull(pubDate);
|
||||
Date asOfDate = (Date)nodeService.getProperty(testRM263Record, PROP_SEARCH_ASOF);
|
||||
assertNull(asOfDate);
|
||||
|
||||
DispositionAction da = dispositionService.getNextDispositionAction(testRM263Record);
|
||||
assertNotNull(da);
|
||||
assertNull(da.getAsOfDate());
|
||||
|
||||
//rma:recordSearchDispositionActionAsOf"
|
||||
nodeService.setProperty(testRM263Record, DOD5015Model.PROP_PUBLICATION_DATE, new Date());
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void test(Void result) throws Exception
|
||||
{
|
||||
Date pubDate = (Date)nodeService.getProperty(testRM263Record, DOD5015Model.PROP_PUBLICATION_DATE);
|
||||
assertNotNull(pubDate);
|
||||
Date asOfDate = (Date)nodeService.getProperty(testRM263Record, PROP_SEARCH_ASOF);
|
||||
assertNotNull(asOfDate);
|
||||
|
||||
DispositionAction da = dispositionService.getNextDispositionAction(testRM263Record);
|
||||
assertNotNull(da);
|
||||
assertNotNull(da.getAsOfDate());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private NodeRef testRM386RecordCategory;
|
||||
private DispositionSchedule testRM386DispositionSchedule;
|
||||
private NodeRef testRM386Record;
|
||||
|
@@ -428,7 +428,7 @@ public class DispositionRestApiTest extends BaseRMWebScriptTestCase implements R
|
||||
JSONObject periodProperties = data.getJSONObject("periodProperties");
|
||||
assertEquals(SERVICE_URL_PREFIX + GET_LIST_URL + "/periodproperties", periodProperties.getString("url"));
|
||||
items = periodProperties.getJSONArray("items");
|
||||
assertEquals(5, items.length());
|
||||
assertEquals(4, items.length());
|
||||
assertTrue(items.length() > 0);
|
||||
item = items.getJSONObject(0);
|
||||
assertTrue(item.length() == 2);
|
||||
|
Reference in New Issue
Block a user