From aa6f02fbc2b6b14d8d6dfcc0b55ca2e3f394512c Mon Sep 17 00:00:00 2001 From: Cristina Mocanu Date: Mon, 10 Oct 2016 15:23:47 +0000 Subject: [PATCH] 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/BRANCHES/DEV/5.2.N/root@131278 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(); } }