use of org.alfresco.util.Pair in project records-management by Alfresco.
the class RecordsManagementAdminServiceImplTest method testCreateReference.
public void testCreateReference() throws Exception {
inTest = true;
try {
// Create the necessary test objects in the db: two records.
final Pair<NodeRef, NodeRef> testRecords = retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<Pair<NodeRef, NodeRef>>() {
public Pair<NodeRef, NodeRef> execute() throws Throwable {
NodeRef rec1 = utils.createRecord(rmFolder, "testRecordA" + System.currentTimeMillis());
NodeRef rec2 = utils.createRecord(rmFolder, "testRecordB" + System.currentTimeMillis());
Pair<NodeRef, NodeRef> result = new Pair<NodeRef, NodeRef>(rec1, rec2);
return result;
}
});
final NodeRef testRecord1 = testRecords.getFirst();
final NodeRef testRecord2 = testRecords.getSecond();
retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<Void>() {
public Void execute() throws Throwable {
utils.completeRecord(testRecord1);
utils.completeRecord(testRecord2);
policyComponent.bindClassBehaviour(RecordsManagementPolicies.BEFORE_CREATE_REFERENCE, this, new JavaBehaviour(RecordsManagementAdminServiceImplTest.this, "beforeCreateReference", NotificationFrequency.EVERY_EVENT));
policyComponent.bindClassBehaviour(RecordsManagementPolicies.ON_CREATE_REFERENCE, this, new JavaBehaviour(RecordsManagementAdminServiceImplTest.this, "onCreateReference", NotificationFrequency.EVERY_EVENT));
assertFalse(beforeMarker);
assertFalse(onMarker);
relationshipService.addRelationship(CUSTOM_REF_VERSIONS.getLocalName(), testRecord1, testRecord2);
assertTrue(beforeMarker);
assertTrue(onMarker);
return null;
}
});
} finally {
inTest = false;
}
}
Aggregations