From 4630626a95e7bcc8282edd3d1b39772a2c2d2874 Mon Sep 17 00:00:00 2001 From: Alan Davis Date: Thu, 3 Nov 2016 13:33:17 +0000 Subject: [PATCH] Merged 5.2.N (5.2.1) to HEAD (5.2) 131278 cmocanu: REPO-1360 - Filter sites by visibility - add automated test for NOT in where clause git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@132230 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../rest/api/tests/TestPersonSites.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/source/test-java/org/alfresco/rest/api/tests/TestPersonSites.java b/source/test-java/org/alfresco/rest/api/tests/TestPersonSites.java index 9aec4fb3ca..6a06ec4f63 100644 --- a/source/test-java/org/alfresco/rest/api/tests/TestPersonSites.java +++ b/source/test-java/org/alfresco/rest/api/tests/TestPersonSites.java @@ -881,7 +881,19 @@ public class TestPersonSites extends EnterpriseTestApi return getSiteMembershipsForPersonAndNetwork(paging, params, person41, network4, runAsUserTenant); } + private ListResponse getSiteMembershipsForPerson41NOTWhere(final Paging paging, String siteVisibility, boolean runAsUserTenant) throws Exception + { + final Map params = new HashMap<>(); + params.put("orderBy", "title" + " " + "ASC"); + if (siteVisibility != null) + { + params.put("where", "(NOT visibility=" + siteVisibility + ")"); + } + + return getSiteMembershipsForPersonAndNetwork(paging, params, person41, network4, runAsUserTenant); + } + private ListResponse getSiteMembershipsForPerson41(final Paging paging, String siteVisibility) throws Exception { return getSiteMembershipsForPerson41(paging, siteVisibility, true); @@ -962,6 +974,19 @@ public class TestPersonSites extends EnterpriseTestApi } } + public void testGetSiteMembershipsWhereSiteVisibilityNOTIncluded() throws Exception + { + try + { + getSiteMembershipsForPerson41NOTWhere(null, SiteVisibility.MODERATED.name(), false); + fail(""); + } + catch (PublicApiException e) + { + assertEquals(HttpStatus.SC_BAD_REQUEST, e.getHttpResponse().getStatusCode()); + } + } + @Test public void testGetSiteMembershipsWithWhereClause() throws Exception { @@ -973,6 +998,7 @@ public class TestPersonSites extends EnterpriseTestApi testGetSiteMembershipsWhereSiteVisibilityPublicAndSkipCount(); testGetSiteMembershipsWhereSiteVisibilityModerated(); testGetSiteMembershipsWhereSiteVisibilityInvalid(); + testGetSiteMembershipsWhereSiteVisibilityNOTIncluded(); } }