Merged 5.2.N-AUDIT-API (5.2.2) to 5.2.N (5.2.2)

137906 aforascu: REPO-1785 / REPO-2585 - Retrieve Audit Application info
       - deleted AuditTest.java and added the methods from it to AuditAppTest.java


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@137966 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jan Vonka
2017-07-12 12:10:01 +00:00
parent 8ed0f981b8
commit 4032d49248
2 changed files with 43 additions and 70 deletions

View File

@@ -28,6 +28,7 @@ package org.alfresco.rest.api.tests;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.util.HashMap;
import java.util.List;
@@ -36,22 +37,34 @@ import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.rest.AbstractSingleNetworkSiteTest;
import org.alfresco.rest.api.tests.client.PublicApiClient;
import org.alfresco.rest.api.tests.client.PublicApiClient.AuditApps;
import org.alfresco.rest.api.tests.client.PublicApiClient.ListResponse;
import org.alfresco.rest.api.tests.client.PublicApiClient.Paging;
import org.alfresco.rest.api.tests.client.data.AuditApp;
import org.alfresco.service.cmr.audit.AuditService;
import org.alfresco.service.cmr.security.AuthorityService;
import org.alfresco.service.cmr.security.PermissionService;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
public class AuditAppTest extends AuditTest
public class AuditAppTest extends AbstractSingleNetworkSiteTest
{
protected PermissionService permissionService;
protected AuthorityService authorityService;
protected AuditService auditService;
@Before
public void setup() throws Exception
{
super.setup();
permissionService = applicationContext.getBean("permissionService", PermissionService.class);
authorityService = (AuthorityService) applicationContext.getBean("AuthorityService");
auditService = applicationContext.getBean("AuditService", AuditService.class);
}
@After
@@ -255,4 +268,33 @@ public class AuditAppTest extends AuditTest
}
protected void enableSystemAudit()
{
boolean isEnabled = auditService.isAuditEnabled();
if (!isEnabled)
{
auditService.setAuditEnabled(true);
isEnabled = auditService.isAuditEnabled();
if (!isEnabled)
{
fail("Failed to enable system audit for testing");
}
}
}
protected void disableSystemAudit()
{
boolean isEnabled = auditService.isAuditEnabled();
if (isEnabled)
{
auditService.setAuditEnabled(false);
isEnabled = auditService.isAuditEnabled();
if (isEnabled)
{
fail("Failed to disable system audit for testing");
}
}
}
}