From 97299a3616b1f5a2d587d8f9d1d0dde11bc8e418 Mon Sep 17 00:00:00 2001 From: Jan Vonka Date: Wed, 12 Jul 2017 12:11:02 +0000 Subject: [PATCH] Merged 5.2.N-AUDIT-API (5.2.2) to 5.2.N (5.2.2) 137927 eknizat: REPO-1298 Enable/Disable Application Auditing - Changes following code review git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@137972 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- source/java/org/alfresco/rest/api/impl/AuditImpl.java | 4 ++-- .../org/alfresco/rest/api/tests/AuditAppTest.java | 7 ++++--- .../alfresco/rest/api/tests/client/PublicApiClient.java | 3 +-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/source/java/org/alfresco/rest/api/impl/AuditImpl.java b/source/java/org/alfresco/rest/api/impl/AuditImpl.java index 33717fda50..a9431015fe 100644 --- a/source/java/org/alfresco/rest/api/impl/AuditImpl.java +++ b/source/java/org/alfresco/rest/api/impl/AuditImpl.java @@ -381,11 +381,11 @@ public class AuditImpl implements Audit // Enable/Disable audit application if (auditApp.getIsEnabled() && !auditApplication.isEnabled()) { - auditService.enableAudit(auditApplication.getName(), auditApplication.getKey()); + auditService.enableAudit(auditApplication.getName(), null); } else if (!auditApp.getIsEnabled() && auditApplication.isEnabled()) { - auditService.disableAudit(auditApplication.getName(), auditApplication.getKey()); + auditService.disableAudit(auditApplication.getName(), null); } return new AuditApp(auditApplication.getKey().substring(1), auditApplication.getName(), auditApp.getIsEnabled()); diff --git a/source/test-java/org/alfresco/rest/api/tests/AuditAppTest.java b/source/test-java/org/alfresco/rest/api/tests/AuditAppTest.java index 9cb225a3db..542a9192f3 100644 --- a/source/test-java/org/alfresco/rest/api/tests/AuditAppTest.java +++ b/source/test-java/org/alfresco/rest/api/tests/AuditAppTest.java @@ -249,9 +249,10 @@ public class AuditAppTest extends AbstractSingleNetworkSiteTest setRequestContext(networkOne.getId(), networkAdmin, DEFAULT_ADMIN_PWD); - //Get one of the audit app ids (default tagging) + //Get one of the audit app ids ( fail test if there are no audit apps in the system ) ListResponse apps = publicApiClient.auditApps().getAuditApps(null, "Getting audit apps error ", HttpServletResponse.SC_OK); - appId = (apps.getList().size()>0) ? apps.getList().get(0).getId() : "tagging"; + if (apps.getList().size() == 0) fail("There are no audit applications to run this test against."); + appId = apps.getList().get(0).getId(); // +ve // Disable audit app @@ -281,7 +282,7 @@ public class AuditAppTest extends AbstractSingleNetworkSiteTest // 501 AuthenticationUtil.setFullyAuthenticatedUser(networkAdmin); disableSystemAudit(); - responseAuditApp = publicApiClient.auditApps().updateAuditApp(appId,requestAuditApp,null, HttpServletResponse.SC_NOT_IMPLEMENTED); + publicApiClient.auditApps().updateAuditApp(appId,requestAuditApp,null, HttpServletResponse.SC_NOT_IMPLEMENTED); enableSystemAudit(); } diff --git a/source/test-java/org/alfresco/rest/api/tests/client/PublicApiClient.java b/source/test-java/org/alfresco/rest/api/tests/client/PublicApiClient.java index 347ef36b13..a911e43f18 100644 --- a/source/test-java/org/alfresco/rest/api/tests/client/PublicApiClient.java +++ b/source/test-java/org/alfresco/rest/api/tests/client/PublicApiClient.java @@ -2480,7 +2480,7 @@ public class PublicApiClient public AuditApp updateAuditApp(String applicationId, AuditApp auditApp, Map params, int expectedStatus) throws PublicApiException { - HttpResponse response = update("audit-applications", applicationId,null,null, auditApp.toJSON().toString(), params, "Eriks test failed", expectedStatus); + HttpResponse response = update("audit-applications", applicationId,null,null, auditApp.toJSON().toString(), params, "Failed to update Audit Application", expectedStatus); if (response != null && response.getJsonResponse() != null) { @@ -2490,7 +2490,6 @@ public class PublicApiClient return AuditApp.parseAuditApp(jsonEntry); } } - return null; }