RM-1771 (SOLR dependent integration tests failing)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@90204 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Tuna Aksoy
2014-11-10 21:51:51 +00:00
parent 4e64b26c78
commit 2a4e0a3f84
6 changed files with 242 additions and 227 deletions

View File

@@ -130,41 +130,37 @@ public class PublishUpdatesJobExecuter extends RecordsManagementJobExecuter
{ {
if (nodeService.exists(nodeRef)) if (nodeService.exists(nodeRef))
{ {
boolean publishing = (Boolean)nodeService.getProperty(nodeRef, PROP_PUBLISH_IN_PROGRESS); // Mark the update node as publishing in progress
if (!publishing) markPublishInProgress(nodeRef);
try
{ {
// Mark the update node as publishing in progress Date start = new Date();
markPublishInProgress(nodeRef); if (logger.isDebugEnabled())
try
{ {
Date start = new Date(); logger.debug("Starting publish of updates ...");
if (logger.isDebugEnabled()) logger.debug(" - for " + nodeRef.toString());
{ logger.debug(" - at " + start.toString());
logger.debug("Starting publish of updates ...");
logger.debug(" - for " + nodeRef.toString());
logger.debug(" - at " + start.toString());
}
// Publish updates
publishUpdates(nodeRef);
if (logger.isDebugEnabled())
{
Date end = new Date();
long duration = end.getTime() - start.getTime();
logger.debug("Completed publish of updates ...");
logger.debug(" - for " + nodeRef.toString());
logger.debug(" - at " + end.toString());
logger.debug(" - duration " + Long.toString(duration));
}
} }
finally
// Publish updates
publishUpdates(nodeRef);
if (logger.isDebugEnabled())
{ {
// Ensure the update node has either completed the publish or is marked as no longer in progress Date end = new Date();
unmarkPublishInProgress(nodeRef); long duration = end.getTime() - start.getTime();
logger.debug("Completed publish of updates ...");
logger.debug(" - for " + nodeRef.toString());
logger.debug(" - at " + end.toString());
logger.debug(" - duration " + Long.toString(duration));
} }
} }
finally
{
// Ensure the update node has either completed the publish or is marked as no longer in progress
unmarkPublishInProgress(nodeRef);
}
} }
} }
} }
@@ -221,13 +217,13 @@ public class PublishUpdatesJobExecuter extends RecordsManagementJobExecuter
// Execute query to find updates awaiting publishing // Execute query to find updates awaiting publishing
List<NodeRef> resultNodes = null; List<NodeRef> resultNodes = null;
SearchParameters searchParameters = new SearchParameters(); SearchParameters searchParameters = new SearchParameters();
searchParameters.setQueryConsistency(QueryConsistency.TRANSACTIONAL); searchParameters.setQueryConsistency(QueryConsistency.TRANSACTIONAL);
searchParameters.setQuery(query); searchParameters.setQuery(query);
searchParameters.addStore(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE); searchParameters.addStore(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
searchParameters.setLanguage(SearchService.LANGUAGE_FTS_ALFRESCO); searchParameters.setLanguage(SearchService.LANGUAGE_FTS_ALFRESCO);
try try
{ {
ResultSet results = searchService.query(searchParameters); ResultSet results = searchService.query(searchParameters);

View File

@@ -18,8 +18,19 @@
*/ */
package org.alfresco.module.org_alfresco_module_rm.test.integration.job; package org.alfresco.module.org_alfresco_module_rm.test.integration.job;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import org.alfresco.module.org_alfresco_module_rm.action.impl.CutOffAction;
import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService; import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService;
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction;
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule;
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; 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.alfresco.service.namespace.QName;
import org.alfresco.util.GUID;
/** /**
* Test automatic disposition via scheduled job. * Test automatic disposition via scheduled job.
@@ -57,63 +68,62 @@ public class AutomaticDispositionTest extends BaseRMTestCase
* Given there is a complete record eligible for cut off, when the correct frequency of time passes, then * Given there is a complete record eligible for cut off, when the correct frequency of time passes, then
* the record will be automatically cut off * the record will be automatically cut off
*/ */
// FIXME!!!: Commented out. Will be fixed. public void testAutomaticCutOff()
// public void testAutomaticCutOff() {
// { doBehaviourDrivenTest(new BehaviourDrivenTest()
// doBehaviourDrivenTest(new BehaviourDrivenTest() {
// { NodeRef sourceCategory;
// NodeRef sourceCategory; NodeRef sourceRecordFolder;
// NodeRef sourceRecordFolder; NodeRef record;
// NodeRef record;
// public void given()
// public void given() {
// { // create test data
// // create test data sourceCategory = filePlanService.createRecordCategory(filePlan, GUID.generate());
// sourceCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); DispositionSchedule dis = utils.createBasicDispositionSchedule(sourceCategory, GUID.generate(), GUID.generate(), true, false);
// DispositionSchedule dis = utils.createBasicDispositionSchedule(sourceCategory, GUID.generate(), GUID.generate(), true, false); Map<QName, Serializable> adParams = new HashMap<QName, Serializable>(3);
// Map<QName, Serializable> adParams = new HashMap<QName, Serializable>(3); adParams.put(PROP_DISPOSITION_ACTION_NAME, CutOffAction.NAME);
// adParams.put(PROP_DISPOSITION_ACTION_NAME, CutOffAction.NAME); adParams.put(PROP_DISPOSITION_DESCRIPTION, GUID.generate());
// adParams.put(PROP_DISPOSITION_DESCRIPTION, GUID.generate()); adParams.put(PROP_DISPOSITION_PERIOD, CommonRMTestUtils.PERIOD_IMMEDIATELY);
// adParams.put(PROP_DISPOSITION_PERIOD, CommonRMTestUtils.PERIOD_IMMEDIATELY); dispositionService.addDispositionActionDefinition(dis, adParams);
// dispositionService.addDispositionActionDefinition(dis, adParams); sourceRecordFolder = recordFolderService.createRecordFolder(sourceCategory, GUID.generate());
// sourceRecordFolder = recordFolderService.createRecordFolder(sourceCategory, GUID.generate());
// // create and complete record
// // create and complete record record = utils.createRecord(sourceRecordFolder, GUID.generate());
// record = utils.createRecord(sourceRecordFolder, GUID.generate()); utils.completeRecord(record);
// utils.completeRecord(record);
// // check the disposition action details
// // check the disposition action details DispositionAction dispositionAction = dispositionService.getNextDispositionAction(record);
// DispositionAction dispositionAction = dispositionService.getNextDispositionAction(record); assertNotNull(dispositionAction);
// assertNotNull(dispositionAction); assertNotNull(CutOffAction.NAME, dispositionAction.getName());
// assertNotNull(CutOffAction.NAME, dispositionAction.getName()); assertTrue(dispositionService.isNextDispositionActionEligible(record));
// assertTrue(dispositionService.isNextDispositionActionEligible(record)); }
// }
// public void when() throws Exception
// public void when() throws Exception {
// { // sleep .. allowing the job time to execute
// // sleep .. allowing the job time to execute Thread.sleep(30000);
// Thread.sleep(30000); }
// }
// public void then()
// public void then() {
// { // record should now be cut off
// // record should now be cut off assertTrue(dispositionService.isDisposableItemCutoff(record));
// assertTrue(dispositionService.isDisposableItemCutoff(record));
// // TODO uncomment and ensure is working
// // TODO uncomment and ensure is working
// //RecordsManagementAuditQueryParameters params = new RecordsManagementAuditQueryParameters();
// //RecordsManagementAuditQueryParameters params = new RecordsManagementAuditQueryParameters(); //params.setEvent(CutOffAction.NAME);
// //params.setEvent(CutOffAction.NAME); //params.setMaxEntries(1);
// //params.setMaxEntries(1); //List<RecordsManagementAuditEntry> entries = auditService.getAuditTrail(params);
// //List<RecordsManagementAuditEntry> entries = auditService.getAuditTrail(params); //assertNotNull(entries);
// //assertNotNull(entries); //assertEquals(1, entries.size());
// //assertEquals(1, entries.size());
// //RecordsManagementAuditEntry entry = entries.get(0);
// //RecordsManagementAuditEntry entry = entries.get(0); //assertEquals(record, entry.getNodeRef());
// //assertEquals(record, entry.getNodeRef()); }
// } });
// }); }
// }
// TODO automatic retain // TODO automatic retain

View File

@@ -36,6 +36,7 @@ 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.disposition.property.DispositionProperty;
import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; 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.event.EventCompletionDetails;
import org.alfresco.module.org_alfresco_module_rm.job.PublishUpdatesJobExecuter;
import org.alfresco.module.org_alfresco_module_rm.job.publish.PublishExecutor; import org.alfresco.module.org_alfresco_module_rm.job.publish.PublishExecutor;
import org.alfresco.module.org_alfresco_module_rm.job.publish.PublishExecutorRegistry; import org.alfresco.module.org_alfresco_module_rm.job.publish.PublishExecutorRegistry;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
@@ -899,125 +900,124 @@ public class DispositionServiceImplTest extends BaseRMTestCase
}); });
} }
// private NodeRef testRM386RecordCategory; private NodeRef testRM386RecordCategory;
// private DispositionSchedule testRM386DispositionSchedule; private DispositionSchedule testRM386DispositionSchedule;
// private NodeRef testRM386Record; private NodeRef testRM386Record;
/** /**
* Test to make sure all the search rollups are correct after schedule is updated * Test to make sure all the search rollups are correct after schedule is updated
* @throws Exception * @throws Exception
*/ */
// FIXME!!!: Commented out. Will be fixed. public void testRM386() throws Exception
// public void testRM386() throws Exception {
// { doTestInTransaction(new Test<Void>()
// doTestInTransaction(new Test<Void>() {
// { @Override
// @Override public Void run() throws Exception
// public Void run() throws Exception {
// { testRM386RecordCategory = filePlanService.createRecordCategory(rmContainer, "RM386");
// testRM386RecordCategory = filePlanService.createRecordCategory(rmContainer, "RM386"); testRM386DispositionSchedule = utils.createBasicDispositionSchedule(
// testRM386DispositionSchedule = utils.createBasicDispositionSchedule( testRM386RecordCategory,
// testRM386RecordCategory, "disposition instructions",
// "disposition instructions", "disposition authority",
// "disposition authority", true, // record level
// true, // record level true); // set the default actions
// true); // set the default actions
// NodeRef recordFolder = recordFolderService.createRecordFolder(testRM386RecordCategory, "testRM386RecordFolder");
// NodeRef recordFolder = recordFolderService.createRecordFolder(testRM386RecordCategory, "testRM386RecordFolder"); testRM386Record = utils.createRecord(recordFolder, "testRM386Record", "testRM386Record");
// testRM386Record = utils.createRecord(recordFolder, "testRM386Record", "testRM386Record");
// return null;
// return null; }
// }
// @SuppressWarnings("unchecked")
// @SuppressWarnings("unchecked") @Override
// @Override public void test(Void result) throws Exception
// public void test(Void result) throws Exception {
// { // Test the rollups for the record
// // Test the rollups for the record Map<QName, Serializable> properties = nodeService.getProperties(testRM386Record);
// Map<QName, Serializable> properties = nodeService.getProperties(testRM386Record);
// assertEquals(Boolean.TRUE, properties.get(PROP_RS_HAS_DISPOITION_SCHEDULE));
// assertEquals(Boolean.TRUE, properties.get(PROP_RS_HAS_DISPOITION_SCHEDULE)); assertEquals(CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, properties.get(PROP_RS_DISPOITION_AUTHORITY));
// assertEquals(CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, properties.get(PROP_RS_DISPOITION_AUTHORITY)); assertEquals(CommonRMTestUtils.DEFAULT_DISPOSITION_INSTRUCTIONS, properties.get(PROP_RS_DISPOITION_INSTRUCTIONS));
// assertEquals(CommonRMTestUtils.DEFAULT_DISPOSITION_INSTRUCTIONS, properties.get(PROP_RS_DISPOITION_INSTRUCTIONS));
// assertEquals("none", properties.get(PROP_RS_DISPOSITION_PERIOD));
// assertEquals("none", properties.get(PROP_RS_DISPOSITION_PERIOD)); assertEquals("0", properties.get(PROP_RS_DISPOSITION_PERIOD_EXPRESSION));
// assertEquals("0", properties.get(PROP_RS_DISPOSITION_PERIOD_EXPRESSION));
// List<String> events = (List<String>)properties.get(PROP_RS_DISPOSITION_EVENTS);
// List<String> events = (List<String>)properties.get(PROP_RS_DISPOSITION_EVENTS); assertNotNull(events);
// assertNotNull(events); assertEquals(1, events.size());
// assertEquals(1, events.size()); assertEquals(CommonRMTestUtils.DEFAULT_EVENT_NAME, events.get(0));
// assertEquals(CommonRMTestUtils.DEFAULT_EVENT_NAME, events.get(0)); assertEquals(Boolean.FALSE, properties.get(PROP_RS_DISPOSITION_EVENTS_ELIGIBLE));
// assertEquals(Boolean.FALSE, properties.get(PROP_RS_DISPOSITION_EVENTS_ELIGIBLE));
// assertEquals("cutoff", properties.get(PROP_RS_DISPOSITION_ACTION_NAME));
// assertEquals("cutoff", properties.get(PROP_RS_DISPOSITION_ACTION_NAME)); assertNull(properties.get(PROP_RS_DISPOSITION_ACTION_AS_OF));
// assertNull(properties.get(PROP_RS_DISPOSITION_ACTION_AS_OF)); }
// } });
// });
// doTestInTransaction(new Test<DispositionActionDefinition>()
// doTestInTransaction(new Test<DispositionActionDefinition>() {
// { @Override
// @Override public DispositionActionDefinition run() throws Exception
// public DispositionActionDefinition run() throws Exception {
// { DispositionActionDefinition actionDefinition = testRM386DispositionSchedule.getDispositionActionDefinitionByName("cutoff");
// DispositionActionDefinition actionDefinition = testRM386DispositionSchedule.getDispositionActionDefinitionByName("cutoff"); assertNotNull(actionDefinition);
// assertNotNull(actionDefinition);
// Map<QName, Serializable> adParams = new HashMap<QName, Serializable>(3);
// Map<QName, Serializable> adParams = new HashMap<QName, Serializable>(3);
// List<String> events = new ArrayList<String>(1);
// List<String> events = new ArrayList<String>(1); events.add(CommonRMTestUtils.DEFAULT_EVENT_NAME);
// events.add(CommonRMTestUtils.DEFAULT_EVENT_NAME); events.add("obsolete");
// events.add("obsolete"); adParams.put(PROP_DISPOSITION_EVENT, (Serializable)events);
// adParams.put(PROP_DISPOSITION_EVENT, (Serializable)events); adParams.put(PROP_DISPOSITION_PERIOD, "week|1");
// adParams.put(PROP_DISPOSITION_PERIOD, "week|1");
// dispositionService.updateDispositionActionDefinition(
// dispositionService.updateDispositionActionDefinition( actionDefinition,
// actionDefinition, adParams);
// adParams);
// return actionDefinition;
// return actionDefinition; }
// }
// @SuppressWarnings("unchecked")
// @SuppressWarnings("unchecked") @Override
// @Override public void test(DispositionActionDefinition result) throws Exception
// public void test(DispositionActionDefinition result) throws Exception {
// { DispositionActionDefinition actionDefinition = testRM386DispositionSchedule.getDispositionActionDefinitionByName("cutoff");
// DispositionActionDefinition actionDefinition = testRM386DispositionSchedule.getDispositionActionDefinitionByName("cutoff"); assertNotNull(actionDefinition);
// assertNotNull(actionDefinition); assertTrue(nodeService.hasAspect(actionDefinition.getNodeRef(), ASPECT_UNPUBLISHED_UPDATE));
// assertTrue(nodeService.hasAspect(actionDefinition.getNodeRef(), ASPECT_UNPUBLISHED_UPDATE));
// // Publish the updates
// // Publish the updates PublishUpdatesJobExecuter updater = (PublishUpdatesJobExecuter)applicationContext.getBean("publishUpdatesJobExecuter");
// PublishUpdatesJobExecuter updater = (PublishUpdatesJobExecuter)applicationContext.getBean("publishUpdatesJobExecuter"); updater.executeImpl();
// updater.executeImpl();
// assertFalse(nodeService.hasAspect(actionDefinition.getNodeRef(), ASPECT_UNPUBLISHED_UPDATE));
// assertFalse(nodeService.hasAspect(actionDefinition.getNodeRef(), ASPECT_UNPUBLISHED_UPDATE));
// // Check the record has been updated
// // Check the record has been updated DispositionAction dispositionAction = dispositionService.getNextDispositionAction(testRM386Record);
// DispositionAction dispositionAction = dispositionService.getNextDispositionAction(testRM386Record); assertNotNull(dispositionAction);
// assertNotNull(dispositionAction); assertEquals("cutoff", dispositionAction.getName());
// assertEquals("cutoff", dispositionAction.getName()); assertNotNull(dispositionAction.getAsOfDate());
// assertNotNull(dispositionAction.getAsOfDate()); assertEquals(2, dispositionAction.getEventCompletionDetails().size());
// assertEquals(2, dispositionAction.getEventCompletionDetails().size());
// // Test the rollups for the record
// // Test the rollups for the record Map<QName, Serializable> properties = nodeService.getProperties(testRM386Record);
// Map<QName, Serializable> properties = nodeService.getProperties(testRM386Record);
// assertEquals(Boolean.TRUE, properties.get(PROP_RS_HAS_DISPOITION_SCHEDULE));
// assertEquals(Boolean.TRUE, properties.get(PROP_RS_HAS_DISPOITION_SCHEDULE)); assertEquals(CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, properties.get(PROP_RS_DISPOITION_AUTHORITY));
// assertEquals(CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, properties.get(PROP_RS_DISPOITION_AUTHORITY)); assertEquals(CommonRMTestUtils.DEFAULT_DISPOSITION_INSTRUCTIONS, properties.get(PROP_RS_DISPOITION_INSTRUCTIONS));
// assertEquals(CommonRMTestUtils.DEFAULT_DISPOSITION_INSTRUCTIONS, properties.get(PROP_RS_DISPOITION_INSTRUCTIONS));
// assertEquals("week", properties.get(PROP_RS_DISPOSITION_PERIOD));
// assertEquals("week", properties.get(PROP_RS_DISPOSITION_PERIOD)); assertEquals("1", properties.get(PROP_RS_DISPOSITION_PERIOD_EXPRESSION));
// assertEquals("1", properties.get(PROP_RS_DISPOSITION_PERIOD_EXPRESSION));
// List<String> events = (List<String>)properties.get(PROP_RS_DISPOSITION_EVENTS);
// List<String> events = (List<String>)properties.get(PROP_RS_DISPOSITION_EVENTS); assertNotNull(events);
// assertNotNull(events); assertEquals(2, events.size());
// assertEquals(2, events.size()); assertEquals(Boolean.FALSE, properties.get(PROP_RS_DISPOSITION_EVENTS_ELIGIBLE));
// assertEquals(Boolean.FALSE, properties.get(PROP_RS_DISPOSITION_EVENTS_ELIGIBLE));
// assertEquals("cutoff", properties.get(PROP_RS_DISPOSITION_ACTION_NAME));
// assertEquals("cutoff", properties.get(PROP_RS_DISPOSITION_ACTION_NAME)); assertNotNull(properties.get(PROP_RS_DISPOSITION_ACTION_AS_OF));
// assertNotNull(properties.get(PROP_RS_DISPOSITION_ACTION_AS_OF)); }
// } });
// });
// }
// }
} }

View File

@@ -136,30 +136,29 @@ public class RecordsManagementSearchServiceImplTest extends BaseRMTestCase
super.tearDown(); super.tearDown();
} }
// FIXME!!!: Commented out. Will be fixed. public void testSearch()
// public void testSearch() {
// { // Full text search
// // Full text search doTestInTransaction(new Test<Void>()
// doTestInTransaction(new Test<Void>() {
// { @Override
// @Override public Void run()
// public Void run() {
// { String query = "keywords:\"elephant\"";
// String query = "keywords:\"elephant\""; RecordsManagementSearchParameters params = new RecordsManagementSearchParameters();
// RecordsManagementSearchParameters params = new RecordsManagementSearchParameters(); params.setIncludeUndeclaredRecords(true);
// params.setIncludeUndeclaredRecords(true); List<Pair<NodeRef, NodeRef>> results = rmSearchService.search(siteId, query, params);
// List<Pair<NodeRef, NodeRef>> results = rmSearchService.search(siteId, query, params); assertNotNull(results);
// assertNotNull(results); assertEquals(2, results.size());
// assertEquals(2, results.size());
// return null;
// return null; }
// } }, AuthenticationUtil.getSystemUserName());
// }, AuthenticationUtil.getSystemUserName());
// // Property search
// // Property search
// //
// // }
// }
public void testSaveSearch() public void testSaveSearch()
{ {

View File

@@ -0,0 +1 @@
index.subsystem.name=buildonly

View File

@@ -218,4 +218,13 @@
</property> </property>
</bean> </bean>
<bean id="testPlaceholderConfigurer" class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:alfresco-global-test.properties</value>
</list>
</property>
<property name="ignoreUnresolvablePlaceholders" value="true" />
<property name="order" value="-1" />
</bean>
</beans> </beans>