RM-5344 Handle case where site with id "rm" doesn't exist.

This is not possible normally, but it does happen with the integration tests.

Also fix some whitespace in the test class.
This commit is contained in:
Tom Page
2018-01-04 14:28:27 +00:00
parent 29e00d1ec2
commit 77b5d35685
2 changed files with 18 additions and 13 deletions

View File

@@ -76,6 +76,7 @@ import org.alfresco.service.cmr.repository.MLText;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.security.AccessStatus;
import org.alfresco.service.cmr.site.SiteInfo;
import org.alfresco.service.cmr.site.SiteService;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
@@ -1104,10 +1105,14 @@ public class RecordsManagementAuditServiceImpl extends AbstractLifecycleBean
}
// Get audit entries
QName siteType = nodeService.getType(siteService.getSite(DEFAULT_SITE_NAME).getNodeRef());
if (siteType.equals(TYPE_DOD_5015_SITE))
SiteInfo siteInfo = siteService.getSite(DEFAULT_SITE_NAME);
if (siteInfo != null)
{
auditService.auditQuery(callback, dod5015AuditQueryParams, maxEntries);
QName siteType = nodeService.getType(siteInfo.getNodeRef());
if (siteType.equals(TYPE_DOD_5015_SITE))
{
auditService.auditQuery(callback, dod5015AuditQueryParams, maxEntries);
}
}
// We always need to make the standard query - regardless of the type of RM site (to get events like RM site created).
auditService.auditQuery(callback, auditQueryParams, maxEntries);

View File

@@ -78,18 +78,18 @@ public class RecordsManagementAuditServiceImplTest extends BaseRMTestCase
@Override
public Void run() throws Exception
{
// test start time recorded
testStartTime = new Date();
// test start time recorded
testStartTime = new Date();
// Stop and clear the log
rmAuditService.stopAuditLog(filePlan);
rmAuditService.clearAuditLog(filePlan);
rmAuditService.startAuditLog(filePlan);
// Stop and clear the log
rmAuditService.stopAuditLog(filePlan);
rmAuditService.clearAuditLog(filePlan);
rmAuditService.startAuditLog(filePlan);
// check that audit service is started
assertTrue(rmAuditService.isAuditLogEnabled(filePlan));
// check that audit service is started
assertTrue(rmAuditService.isAuditLogEnabled(filePlan));
return null;
return null;
}
});
}
@@ -198,7 +198,7 @@ public class RecordsManagementAuditServiceImplTest extends BaseRMTestCase
}
});
}
/**
* Test getAuditTrail method and parameter filters.
*/