From a5b86b073e0a476b34846e088e54aaed9f06cbeb Mon Sep 17 00:00:00 2001 From: kcichonczyk Date: Thu, 17 Nov 2022 16:45:38 +0100 Subject: [PATCH 01/27] [ACS-3973] Added PipelineSuite (and its test classes) that belonged to the master branch --- .../search/SearchCasesTest.java | 293 ++++++++++++++++++ e2e-test/src/test/resources/PipelineSuite.xml | 16 + 2 files changed, 309 insertions(+) create mode 100644 e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java create mode 100644 e2e-test/src/test/resources/PipelineSuite.xml diff --git a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java new file mode 100644 index 000000000..cf5d1f6fa --- /dev/null +++ b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java @@ -0,0 +1,293 @@ +package org.alfresco.test.search.functional.searchServices.search; + +import org.alfresco.rest.search.FacetFieldBucket; +import org.alfresco.rest.search.RestRequestFacetFieldModel; +import org.alfresco.rest.search.RestRequestFacetFieldsModel; +import org.alfresco.rest.search.RestRequestQueryModel; +import org.alfresco.rest.search.RestResultBucketsModel; +import org.alfresco.rest.search.SearchRequest; +import org.alfresco.rest.search.SearchResponse; +import org.alfresco.utility.model.FileModel; +import org.alfresco.utility.model.FileType; +import org.hamcrest.Matchers; +import org.springframework.http.HttpStatus; +import org.testng.Assert; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +import java.util.ArrayList; +import java.util.List; + +public class SearchCasesTest extends AbstractSearchServicesE2ETest +{ + @BeforeClass(alwaysRun = true) + public void dataPreparation() throws Exception + { + searchServicesDataPreparation(); + Assert.assertTrue(waitForContentIndexing(file4.getContent(), true)); + } + + @Test(priority=1) + public void testSearchNameField() + { + SearchRequest searchReq = new SearchRequest(); + RestRequestQueryModel queryReq = new RestRequestQueryModel(); + queryReq.setQuery("cm:name:pangram"); + queryReq.setUserQuery("pangram"); + searchReq.setQuery(queryReq); + SearchResponse response = queryAsUser(testUser, "cm:name:pangram"); + restClient.assertStatusCodeIs(HttpStatus.OK); + response.assertThat().entriesListIsNotEmpty(); + } + + @Test(priority=2) + public void testSearchTitleField() + { + SearchRequest searchReq = new SearchRequest(); + RestRequestQueryModel queryReq = new RestRequestQueryModel(); + queryReq.setQuery("cm:title:cars"); + queryReq.setUserQuery("cars"); + searchReq.setQuery(queryReq); + SearchResponse response2 = queryAsUser(testUser, "cm:title:cars"); + restClient.assertStatusCodeIs(HttpStatus.OK); + response2.assertThat().entriesListIsNotEmpty(); + } + + @Test(priority=3) + public void testSearchDescriptionField() + { + SearchRequest searchReq = new SearchRequest(); + RestRequestQueryModel queryReq = new RestRequestQueryModel(); + queryReq.setQuery("cm:description:alfresco"); + queryReq.setUserQuery("alfresco"); + searchReq.setQuery(queryReq); + SearchResponse response3 = queryAsUser(testUser, "cm:description:alfresco"); + restClient.assertStatusCodeIs(HttpStatus.OK); + response3.assertThat().entriesListIsNotEmpty(); + } + + @Test(priority=4) + public void testSearchContentField() + { + SearchRequest searchReq = new SearchRequest(); + RestRequestQueryModel queryReq = new RestRequestQueryModel(); + queryReq.setQuery("cm:content:unique"); + queryReq.setUserQuery("unique"); + searchReq.setQuery(queryReq); + SearchResponse response4 = queryAsUser(testUser, "cm:content:unique"); + restClient.assertStatusCodeIs(HttpStatus.OK); + response4.assertThat().entriesListIsNotEmpty(); + } + + @Test(priority=5) + public void testSearchUpdateContent() + { + SearchRequest searchReq = new SearchRequest(); + + SearchResponse response4 = queryAsUser(testUser, "cm:content:brown"); + restClient.assertStatusCodeIs(HttpStatus.OK); + response4.assertThat().entriesListIsNotEmpty(); + String newContent = "The quick red fox jumps over the lazy dog"; + + dataContent.usingUser(adminUserModel).usingSite(testSite).usingResource(file) + .updateContent(newContent); + + Assert.assertTrue(waitForContentIndexing("red", true)); + + SearchResponse response5 = queryAsUser(testUser, "cm:content:brown"); + restClient.assertStatusCodeIs(HttpStatus.OK); + response5.assertThat().entriesListIsEmpty(); + } + + @Test(priority=6) + public void testSearchTextFile() + { + SearchRequest searchReq = new SearchRequest(); + RestRequestQueryModel queryReq = new RestRequestQueryModel(); + queryReq.setQuery("cm:name:pangram.txt"); + queryReq.setUserQuery("pangram.txt"); + searchReq.setQuery(queryReq); + SearchResponse response6 = queryAsUser(testUser, "cm:name:pangram.txt"); + restClient.assertStatusCodeIs(HttpStatus.OK); + response6.assertThat().entriesListIsNotEmpty(); + } + + @Test(priority=7) + public void testSearchPDFFile() + { + SearchRequest searchReq = new SearchRequest(); + RestRequestQueryModel queryReq = new RestRequestQueryModel(); + queryReq.setQuery("cm:name:cars.PDF"); + queryReq.setUserQuery("cars.PDF"); + searchReq.setQuery(queryReq); + SearchResponse response6 = queryAsUser(testUser, "cm:name:cars.PDF"); + restClient.assertStatusCodeIs(HttpStatus.OK); + response6.assertThat().entriesListIsNotEmpty(); + } + + @Test(priority=8) + public void testSearchDocxFile() + { + SearchRequest searchReq = new SearchRequest(); + RestRequestQueryModel queryReq = new RestRequestQueryModel(); + queryReq.setQuery("cm:name:alfresco.docx"); + queryReq.setUserQuery("alfresco.docx"); + searchReq.setQuery(queryReq); + SearchResponse response6 = queryAsUser(testUser, "cm:name:alfresco.docx"); + restClient.assertStatusCodeIs(HttpStatus.OK); + response6.assertThat().entriesListIsNotEmpty(); + } + + @Test(priority=9) + public void testSearchODTFile() + { + SearchRequest searchReq = new SearchRequest(); + RestRequestQueryModel queryReq = new RestRequestQueryModel(); + queryReq.setQuery("cm:name:unique.ODT"); + queryReq.setUserQuery("unique.ODT"); + searchReq.setQuery(queryReq); + SearchResponse response6 = queryAsUser(testUser, "cm:name:unique.ODT"); + restClient.assertStatusCodeIs(HttpStatus.OK); + response6.assertThat().entriesListIsNotEmpty(); + } + + /** + * { + * "query": { + * "query": "*" + * }, + * "facetFields": { + * "facets": [{"field": "cm:mimetype"},{"field": "modifier"}] + * } + * } + */ + @Test(priority=10) + public void searchWithFactedFields() + { + SearchRequest query = new SearchRequest(); + RestRequestQueryModel queryReq = new RestRequestQueryModel(); + queryReq.setQuery("cm:content:unique"); + query.setQuery(queryReq); + + RestRequestFacetFieldsModel facetFields = new RestRequestFacetFieldsModel(); + List facets = new ArrayList<>(); + facets.add(new RestRequestFacetFieldModel("cm:mimetype")); + facets.add(new RestRequestFacetFieldModel("modifier")); + facetFields.setFacets(facets); + query.setFacetFields(facetFields); + + SearchResponse response = query(query); + + Assert.assertNotNull(response.getContext().getFacetsFields()); + Assert.assertFalse(response.getContext().getFacetsFields().isEmpty()); + Assert.assertNull(response.getContext().getFacetQueries()); + Assert.assertNull(response.getContext().getFacets()); + + RestResultBucketsModel model = response.getContext().getFacetsFields().get(0); + Assert.assertEquals(model.getLabel(), "modifier"); + + model.assertThat().field("label").is("modifier"); + FacetFieldBucket bucket1 = model.getBuckets().get(0); + bucket1.assertThat().field("label").is(testUser.getUsername()); + bucket1.assertThat().field("display").is("FN-" + testUser.getUsername() + " LN-" + testUser.getUsername()); + bucket1.assertThat().field("filterQuery").is("modifier:\"" + testUser.getUsername() + "\""); + bucket1.assertThat().field("count").is(1); + } + + @Test(priority=12) + public void testSearchPhraseQueries() + { + SearchRequest searchReq = new SearchRequest(); + RestRequestQueryModel queryReq = new RestRequestQueryModel(); + queryReq.setQuery("cm:name:alfresco"); + queryReq.setUserQuery("alfresco"); + searchReq.setQuery(queryReq); + SearchResponse response6 = queryAsUser(testUser, "The quick brown fox jumps over the lazy dog"); + restClient.assertStatusCodeIs(HttpStatus.OK); + response6.assertThat().entriesListIsNotEmpty(); + } + + @Test(priority=13) + public void testSearchExactTermQueries() + { + SearchRequest searchReq = new SearchRequest(); + RestRequestQueryModel queryReq = new RestRequestQueryModel(); + queryReq.setQuery("cm:name:alfresco"); + queryReq.setUserQuery("alfresco"); + searchReq.setQuery(queryReq); + SearchResponse response6 = queryAsUser(testUser, "=alfresco"); + restClient.assertStatusCodeIs(HttpStatus.OK); + response6.assertThat().entriesListIsNotEmpty(); + } + + @Test(priority=14) + public void testSearchConjunctionQueries() + { + SearchRequest searchReq = new SearchRequest(); + RestRequestQueryModel queryReq = new RestRequestQueryModel(); + queryReq.setQuery("cm:name:unique"); + queryReq.setUserQuery("unique"); + searchReq.setQuery(queryReq); + SearchResponse response6 = queryAsUser(testUser, "unique AND search"); + restClient.assertStatusCodeIs(HttpStatus.OK); + response6.assertThat().entriesListIsNotEmpty(); + } + + @Test(priority=15) + public void testSearchDisjunctionQueries() + { + SearchRequest searchReq = new SearchRequest(); + RestRequestQueryModel queryReq = new RestRequestQueryModel(); + queryReq.setQuery("cm:name:cars"); + queryReq.setUserQuery("cars"); + searchReq.setQuery(queryReq); + SearchResponse response6 = queryAsUser(testUser, "file OR discovery"); + restClient.assertStatusCodeIs(HttpStatus.OK); + response6.assertThat().entriesListIsNotEmpty(); + } + + @Test(priority=16) + public void testSearchNegationQueries() + { + SearchRequest searchReq = new SearchRequest(); + RestRequestQueryModel queryReq = new RestRequestQueryModel(); + queryReq.setQuery("cm:name:pangram"); + queryReq.setUserQuery("pangram"); + searchReq.setQuery(queryReq); + SearchResponse response6 = queryAsUser(testUser, "pangram NOT pan"); + restClient.assertStatusCodeIs(HttpStatus.OK); + response6.assertThat().entriesListIsNotEmpty(); + } + + @Test(priority=17) + public void testSearchWildcardQueries() + { + SearchRequest searchReq = new SearchRequest(); + RestRequestQueryModel queryReq = new RestRequestQueryModel(); + queryReq.setQuery("cm:name:alfresco"); + queryReq.setUserQuery("alfresco"); + searchReq.setQuery(queryReq); + SearchResponse response6 = queryAsUser(testUser, "al?res*"); + restClient.assertStatusCodeIs(HttpStatus.OK); + response6.assertThat().entriesListIsNotEmpty(); + } + + @Test(priority=18) + public void searchSpecialCharacters() + { + String specialCharfileName = "è¥äæ§ç§-åæ.pdf"; + FileModel file = new FileModel(specialCharfileName, "è¥äæ§ç§-忬¯¸" + "è¥äæ§ç§-忬¯¸", "è¥äæ§ç§-忬¯¸", FileType.TEXT_PLAIN, + "Text file with Special Characters: " + specialCharfileName); + dataContent.usingUser(testUser).usingSite(testSite).createContent(file); + + waitForIndexing(file.getName(), true); + + SearchRequest searchReq = createQuery("name:'" + specialCharfileName + "'"); + SearchResponse nodes = query(searchReq); + + restClient.assertStatusCodeIs(HttpStatus.OK); + nodes.assertThat().entriesListIsNotEmpty(); + + restClient.onResponse().assertThat().body("list.entries.entry[0].name", Matchers.equalToIgnoringCase(specialCharfileName)); + } +} diff --git a/e2e-test/src/test/resources/PipelineSuite.xml b/e2e-test/src/test/resources/PipelineSuite.xml new file mode 100644 index 000000000..8716f6015 --- /dev/null +++ b/e2e-test/src/test/resources/PipelineSuite.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + From cb30043b35b629524f446a38de8e1235490f51e7 Mon Sep 17 00:00:00 2001 From: kcichonczyk Date: Mon, 21 Nov 2022 16:38:44 +0100 Subject: [PATCH 02/27] added header --- .../searchServices/search/SearchCasesTest.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java index cf5d1f6fa..ce6564642 100644 --- a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java +++ b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java @@ -1,3 +1,14 @@ +/*- + * #%L + * Alfresco Elasticsearch Connector :: Database Connector + * %% + * Copyright (C) 2022 Alfresco Software Limited + * %% + * License rights for this program may be obtained from Alfresco Software, Ltd. + * pursuant to a written agreement and any use of this program without such an + * agreement is prohibited. + * #L% + */ package org.alfresco.test.search.functional.searchServices.search; import org.alfresco.rest.search.FacetFieldBucket; From 1c9aef6178ef2a69b20799025f416a625c487f7b Mon Sep 17 00:00:00 2001 From: kcichonczyk Date: Tue, 22 Nov 2022 10:33:41 +0100 Subject: [PATCH 03/27] Changed license header --- .../search/SearchCasesTest.java | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java index ce6564642..eb34138b7 100644 --- a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java +++ b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java @@ -1,12 +1,23 @@ -/*- +/* * #%L - * Alfresco Elasticsearch Connector :: Database Connector + * Alfresco Search Services E2E Test * %% - * Copyright (C) 2022 Alfresco Software Limited + * Copyright (C) 2005 - 2022 Alfresco Software Limited * %% - * License rights for this program may be obtained from Alfresco Software, Ltd. - * pursuant to a written agreement and any use of this program without such an - * agreement is prohibited. + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . * #L% */ package org.alfresco.test.search.functional.searchServices.search; From 6e4f1ddeb67e5a0ff156d78ad870ed6a70bb29b8 Mon Sep 17 00:00:00 2001 From: kcichonczyk Date: Wed, 23 Nov 2022 10:57:29 +0100 Subject: [PATCH 04/27] changed prepared file types --- .../search/AbstractSearchServicesE2ETest.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/AbstractSearchServicesE2ETest.java b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/AbstractSearchServicesE2ETest.java index 4ebb66e9f..cdbac2f77 100644 --- a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/AbstractSearchServicesE2ETest.java +++ b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/AbstractSearchServicesE2ETest.java @@ -2,7 +2,7 @@ * #%L * Alfresco Search Services E2E Test * %% - * Copyright (C) 2005 - 2020 Alfresco Software Limited + * Copyright (C) 2005 - 2022 Alfresco Software Limited * %% * This file is part of the Alfresco software. * If the software was purchased under a paid Alfresco license, the terms of @@ -71,13 +71,13 @@ public abstract class AbstractSearchServicesE2ETest extends AbstractE2EFunctiona file = new FileModel("pangram.txt", "pangram" + title, description, FileType.TEXT_PLAIN, description + " The quick brown fox jumps over the lazy dog"); - file2 = new FileModel("cars.txt", "cars" + title, description, FileType.TEXT_PLAIN, - "The landrover discovery is not a sports car "); + file2 = new FileModel("cars.PDF", "cars", description, FileType.TEXT_PLAIN, + "The landrover discovery is not a sports car"); - file3 = new FileModel("alfresco.txt", "alfresco", "alfresco", FileType.TEXT_PLAIN, + file3 = new FileModel("alfresco.docx", "alfresco", "alfresco", FileType.TEXT_PLAIN, "Alfresco text file for search "); - file4 = new FileModel(unique_searchString + ".txt", "uniquee" + title, description, FileType.TEXT_PLAIN, + file4 = new FileModel(unique_searchString + ".ODT", "uniquee" + title, description, FileType.TEXT_PLAIN, "Unique text file for search "); From f05cb17e5623633d7f541e449e3ff8c165715b3f Mon Sep 17 00:00:00 2001 From: kcichonczyk Date: Wed, 23 Nov 2022 11:36:50 +0100 Subject: [PATCH 05/27] changed files extensions according to extensions in data preparation method --- .../functional/searchServices/search/SearchTest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchTest.java b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchTest.java index 3ecf2d9e2..6043656e7 100644 --- a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchTest.java +++ b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchTest.java @@ -115,9 +115,9 @@ public class SearchTest extends AbstractSearchServicesE2ETest public void searchWithOneSortClause() { // Tests the ascending order first - List expectedOrder = asList("alfresco.txt", "cars.txt", "pangram.txt"); + List expectedOrder = asList("alfresco.docx", "cars.PDF", "pangram.txt"); - SearchRequest searchRequest = createQuery("cm_name:alfresco\\.txt cm_name:cars\\.txt cm_name:pangram\\.txt"); + SearchRequest searchRequest = createQuery("cm_name:alfresco\\.docx cm_name:cars\\.PDF cm_name:pangram\\.txt"); searchRequest.addSortClause("FIELD", "name", true); RestRequestFilterQueryModel filters = new RestRequestFilterQueryModel(); @@ -162,9 +162,9 @@ public class SearchTest extends AbstractSearchServicesE2ETest public void searchWithTwoSortClauses() { // Tests the ascending order first - List expectedOrder = asList("alfresco.txt", "cars.txt", "pangram.txt"); + List expectedOrder = asList("alfresco.docx", "cars.PDF", "pangram.txt"); - SearchRequest searchRequest = createQuery("cm_name:alfresco\\.txt cm_name:cars\\.txt cm_name:pangram\\.txt"); + SearchRequest searchRequest = createQuery("cm_name:alfresco\\.docx cm_name:cars\\.PDF cm_name:pangram\\.txt"); searchRequest.addSortClause("FIELD", "name", true); searchRequest.addSortClause("FIELD", "createdByUser.id", true); From f91962d08aef191a6518a0c324e667a03bb54547 Mon Sep 17 00:00:00 2001 From: kcichonczyk Date: Thu, 24 Nov 2022 12:42:28 +0100 Subject: [PATCH 06/27] changed assertions to match cases, when other tests interfere with buckets or repo. --- .../searchServices/search/SearchCasesTest.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java index eb34138b7..35d69b0f6 100644 --- a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java +++ b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java @@ -104,8 +104,6 @@ public class SearchCasesTest extends AbstractSearchServicesE2ETest @Test(priority=5) public void testSearchUpdateContent() { - SearchRequest searchReq = new SearchRequest(); - SearchResponse response4 = queryAsUser(testUser, "cm:content:brown"); restClient.assertStatusCodeIs(HttpStatus.OK); response4.assertThat().entriesListIsNotEmpty(); @@ -117,8 +115,10 @@ public class SearchCasesTest extends AbstractSearchServicesE2ETest Assert.assertTrue(waitForContentIndexing("red", true)); SearchResponse response5 = queryAsUser(testUser, "cm:content:brown"); + restClient.assertStatusCodeIs(HttpStatus.OK); - response5.assertThat().entriesListIsEmpty(); + int initialEntriesSize = response4.getEntries().size(); + response5.assertThat().entriesListCountIs( initialEntriesSize - 1); } @Test(priority=6) @@ -184,7 +184,7 @@ public class SearchCasesTest extends AbstractSearchServicesE2ETest * } */ @Test(priority=10) - public void searchWithFactedFields() + public void searchWithFacedFields() { SearchRequest query = new SearchRequest(); RestRequestQueryModel queryReq = new RestRequestQueryModel(); @@ -213,7 +213,7 @@ public class SearchCasesTest extends AbstractSearchServicesE2ETest bucket1.assertThat().field("label").is(testUser.getUsername()); bucket1.assertThat().field("display").is("FN-" + testUser.getUsername() + " LN-" + testUser.getUsername()); bucket1.assertThat().field("filterQuery").is("modifier:\"" + testUser.getUsername() + "\""); - bucket1.assertThat().field("count").is(1); + bucket1.assertThat().field("count").isGreaterThan(0); } @Test(priority=12) From 4d566c30b9f6b77cac3d2492c7e15fcd8618d5ae Mon Sep 17 00:00:00 2001 From: Sara Aspery Date: Mon, 28 Nov 2022 16:56:05 +0000 Subject: [PATCH 07/27] add temporary delay for debugging --- .../search/SearchCasesTest.java | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java index 35d69b0f6..88648e27d 100644 --- a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java +++ b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java @@ -29,6 +29,7 @@ import org.alfresco.rest.search.RestRequestQueryModel; import org.alfresco.rest.search.RestResultBucketsModel; import org.alfresco.rest.search.SearchRequest; import org.alfresco.rest.search.SearchResponse; +import org.alfresco.utility.Utility; import org.alfresco.utility.model.FileModel; import org.alfresco.utility.model.FileType; import org.hamcrest.Matchers; @@ -107,16 +108,30 @@ public class SearchCasesTest extends AbstractSearchServicesE2ETest SearchResponse response4 = queryAsUser(testUser, "cm:content:brown"); restClient.assertStatusCodeIs(HttpStatus.OK); response4.assertThat().entriesListIsNotEmpty(); - String newContent = "The quick red fox jumps over the lazy dog"; + //TODO: remove - temp check for debugging + SearchResponse responseRB = queryAsUser(testUser, "cm:content:red"); + restClient.assertStatusCodeIs(HttpStatus.OK); + String beforeUpdate = "brown entries: " + response4.getEntries().size() + " red entries: " + responseRB.getEntries().size(); + Assert.assertEquals(beforeUpdate, "brown entries: 1 red entries: 0"); + + String newContent = "The quick red fox jumps over the lazy dog"; dataContent.usingUser(adminUserModel).usingSite(testSite).usingResource(file) .updateContent(newContent); - Assert.assertTrue(waitForContentIndexing("red", true)); - SearchResponse response5 = queryAsUser(testUser, "cm:content:brown"); + //TODO: remove - artificially long wait for debugging + Utility.waitToLoopTime(60); + SearchResponse response5 = queryAsUser(testUser, "cm:content:brown"); restClient.assertStatusCodeIs(HttpStatus.OK); + + //TODO: remove - temp check for debugging + SearchResponse responseRA = queryAsUser(testUser, "cm:content:red"); + restClient.assertStatusCodeIs(HttpStatus.OK); + String afterUpdate = "brown entries: " + response5.getEntries().size() + " red entries: " + responseRA.getEntries().size(); + Assert.assertEquals(afterUpdate, "brown entries: 0 red entries: 1"); + int initialEntriesSize = response4.getEntries().size(); response5.assertThat().entriesListCountIs( initialEntriesSize - 1); } From 072912bb29c73fd9ddcc84391e75d3c562762a41 Mon Sep 17 00:00:00 2001 From: Sara Aspery Date: Mon, 28 Nov 2022 22:54:26 +0000 Subject: [PATCH 08/27] change query to avoid common sequence --- .../searchServices/search/SearchCasesTest.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java index 88648e27d..99601f9be 100644 --- a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java +++ b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java @@ -110,15 +110,15 @@ public class SearchCasesTest extends AbstractSearchServicesE2ETest response4.assertThat().entriesListIsNotEmpty(); //TODO: remove - temp check for debugging - SearchResponse responseRB = queryAsUser(testUser, "cm:content:red"); + SearchResponse responseRB = queryAsUser(testUser, "cm:content:purple"); restClient.assertStatusCodeIs(HttpStatus.OK); - String beforeUpdate = "brown entries: " + response4.getEntries().size() + " red entries: " + responseRB.getEntries().size(); - Assert.assertEquals(beforeUpdate, "brown entries: 1 red entries: 0"); + String beforeUpdate = "brown entries: " + response4.getEntries().size() + " purple entries: " + responseRB.getEntries().size(); + Assert.assertEquals(beforeUpdate, "brown entries: 1 purple entries: 0"); - String newContent = "The quick red fox jumps over the lazy dog"; + String newContent = "The quick purple fox jumps over the lazy dog"; dataContent.usingUser(adminUserModel).usingSite(testSite).usingResource(file) .updateContent(newContent); - Assert.assertTrue(waitForContentIndexing("red", true)); + Assert.assertTrue(waitForContentIndexing("purple", true)); //TODO: remove - artificially long wait for debugging Utility.waitToLoopTime(60); @@ -127,10 +127,10 @@ public class SearchCasesTest extends AbstractSearchServicesE2ETest restClient.assertStatusCodeIs(HttpStatus.OK); //TODO: remove - temp check for debugging - SearchResponse responseRA = queryAsUser(testUser, "cm:content:red"); + SearchResponse responseRA = queryAsUser(testUser, "cm:content:purple"); restClient.assertStatusCodeIs(HttpStatus.OK); - String afterUpdate = "brown entries: " + response5.getEntries().size() + " red entries: " + responseRA.getEntries().size(); - Assert.assertEquals(afterUpdate, "brown entries: 0 red entries: 1"); + String afterUpdate = "brown entries: " + response5.getEntries().size() + " purple entries: " + responseRA.getEntries().size(); + Assert.assertEquals(afterUpdate, "brown entries: 0 purple entries: 1"); int initialEntriesSize = response4.getEntries().size(); response5.assertThat().entriesListCountIs( initialEntriesSize - 1); From fad52fbfd9294118602e5f522d436366cde8efa6 Mon Sep 17 00:00:00 2001 From: Sara Aspery Date: Tue, 29 Nov 2022 07:12:58 +0000 Subject: [PATCH 09/27] add another debugging query --- .../functional/searchServices/search/SearchCasesTest.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java index 99601f9be..0d5dce30e 100644 --- a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java +++ b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java @@ -105,6 +105,12 @@ public class SearchCasesTest extends AbstractSearchServicesE2ETest @Test(priority=5) public void testSearchUpdateContent() { + //TODO: remove - temp check for debugging + SearchResponse responsePB = queryAsUser(testUser, "cm:content:purpleisnotthereyet"); + restClient.assertStatusCodeIs(HttpStatus.OK); + String beforeAnything = "purple entries: " + responsePB.getEntries().size() + " purple entries: " + responsePB.getEntries().size(); + Assert.assertEquals(beforeAnything, "purpleisnotthereyet entries: 0"); + SearchResponse response4 = queryAsUser(testUser, "cm:content:brown"); restClient.assertStatusCodeIs(HttpStatus.OK); response4.assertThat().entriesListIsNotEmpty(); From 461e1348f43f2dfc8448d43d45e1ce7e7d7639a8 Mon Sep 17 00:00:00 2001 From: Sara Aspery Date: Tue, 29 Nov 2022 09:03:36 +0000 Subject: [PATCH 10/27] add another query for debugging --- .../searchServices/search/SearchCasesTest.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java index 0d5dce30e..503d2d8b0 100644 --- a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java +++ b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java @@ -106,20 +106,20 @@ public class SearchCasesTest extends AbstractSearchServicesE2ETest public void testSearchUpdateContent() { //TODO: remove - temp check for debugging - SearchResponse responsePB = queryAsUser(testUser, "cm:content:purpleisnotthereyet"); + SearchResponse responsePBQ = queryAsUser(testUser, "cm:content:purple"); restClient.assertStatusCodeIs(HttpStatus.OK); - String beforeAnything = "purple entries: " + responsePB.getEntries().size() + " purple entries: " + responsePB.getEntries().size(); - Assert.assertEquals(beforeAnything, "purpleisnotthereyet entries: 0"); + String beforeAnything = "purple entries: " + responsePBQ.getEntries().size(); + Assert.assertEquals(beforeAnything, "purple entries: 0"); SearchResponse response4 = queryAsUser(testUser, "cm:content:brown"); restClient.assertStatusCodeIs(HttpStatus.OK); response4.assertThat().entriesListIsNotEmpty(); //TODO: remove - temp check for debugging - SearchResponse responseRB = queryAsUser(testUser, "cm:content:purple"); + SearchResponse responsePAQ = queryAsUser(testUser, "cm:content:purple"); restClient.assertStatusCodeIs(HttpStatus.OK); - String beforeUpdate = "brown entries: " + response4.getEntries().size() + " purple entries: " + responseRB.getEntries().size(); - Assert.assertEquals(beforeUpdate, "brown entries: 1 purple entries: 0"); + String afterQuery = "purple entries after query: " + responsePAQ.getEntries().size(); + Assert.assertEquals(afterQuery, "purple entries after query: 0"); String newContent = "The quick purple fox jumps over the lazy dog"; dataContent.usingUser(adminUserModel).usingSite(testSite).usingResource(file) From fa1407e20f862f5038c1db36b623f10282e99fb4 Mon Sep 17 00:00:00 2001 From: Sara Aspery Date: Tue, 29 Nov 2022 11:23:38 +0000 Subject: [PATCH 11/27] check content for debugging --- .../search/SearchCasesTest.java | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java index 503d2d8b0..7d97d45a4 100644 --- a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java +++ b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java @@ -22,6 +22,7 @@ */ package org.alfresco.test.search.functional.searchServices.search; +import org.alfresco.rest.exception.EmptyRestModelCollectionException; import org.alfresco.rest.search.FacetFieldBucket; import org.alfresco.rest.search.RestRequestFacetFieldModel; import org.alfresco.rest.search.RestRequestFacetFieldsModel; @@ -103,23 +104,29 @@ public class SearchCasesTest extends AbstractSearchServicesE2ETest } @Test(priority=5) - public void testSearchUpdateContent() + public void testSearchUpdateContent() throws EmptyRestModelCollectionException { //TODO: remove - temp check for debugging - SearchResponse responsePBQ = queryAsUser(testUser, "cm:content:purple"); + SearchResponse responsePBQ = queryAsUser(testUser, "cm:content:purplenotthereyet"); restClient.assertStatusCodeIs(HttpStatus.OK); - String beforeAnything = "purple entries: " + responsePBQ.getEntries().size(); - Assert.assertEquals(beforeAnything, "purple entries: 0"); + String beforeAnything = "purplenotthereyet entries: " + responsePBQ.getEntries().size(); + if (responsePBQ.getEntries().size() != 0) + { + String msg = "Name: " + responsePBQ.getEntryByIndex(0).getName(); + String content = " Content: " + responsePBQ.getEntryByIndex(0).getContent().toString(); + Assert.assertEquals( beforeAnything, msg + content); + } + Assert.assertEquals( beforeAnything, "purplenotthereyet entries: 0"); SearchResponse response4 = queryAsUser(testUser, "cm:content:brown"); restClient.assertStatusCodeIs(HttpStatus.OK); response4.assertThat().entriesListIsNotEmpty(); //TODO: remove - temp check for debugging - SearchResponse responsePAQ = queryAsUser(testUser, "cm:content:purple"); + SearchResponse responsePAQ = queryAsUser(testUser, "cm:content:purplenotthereyet"); restClient.assertStatusCodeIs(HttpStatus.OK); - String afterQuery = "purple entries after query: " + responsePAQ.getEntries().size(); - Assert.assertEquals(afterQuery, "purple entries after query: 0"); + String afterQuery = "purplenotthereyet entries after query: " + responsePAQ.getEntries().size(); + Assert.assertEquals(afterQuery, "purplenotthereyet entries after query: 0"); String newContent = "The quick purple fox jumps over the lazy dog"; dataContent.usingUser(adminUserModel).usingSite(testSite).usingResource(file) From def5cb6885a5d3f6ed26b95ac1fef58c6dcc3451 Mon Sep 17 00:00:00 2001 From: Sara Aspery Date: Wed, 30 Nov 2022 02:20:32 +0000 Subject: [PATCH 12/27] Create file exclusively for test method --- .../search/SearchCasesTest.java | 66 +++++++++---------- 1 file changed, 31 insertions(+), 35 deletions(-) diff --git a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java index 7d97d45a4..94a017547 100644 --- a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java +++ b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java @@ -22,7 +22,6 @@ */ package org.alfresco.test.search.functional.searchServices.search; -import org.alfresco.rest.exception.EmptyRestModelCollectionException; import org.alfresco.rest.search.FacetFieldBucket; import org.alfresco.rest.search.RestRequestFacetFieldModel; import org.alfresco.rest.search.RestRequestFacetFieldsModel; @@ -30,7 +29,7 @@ import org.alfresco.rest.search.RestRequestQueryModel; import org.alfresco.rest.search.RestResultBucketsModel; import org.alfresco.rest.search.SearchRequest; import org.alfresco.rest.search.SearchResponse; -import org.alfresco.utility.Utility; +import org.alfresco.util.GUID; import org.alfresco.utility.model.FileModel; import org.alfresco.utility.model.FileType; import org.hamcrest.Matchers; @@ -104,49 +103,46 @@ public class SearchCasesTest extends AbstractSearchServicesE2ETest } @Test(priority=5) - public void testSearchUpdateContent() throws EmptyRestModelCollectionException + public void testSearchUpdateContent() { - //TODO: remove - temp check for debugging - SearchResponse responsePBQ = queryAsUser(testUser, "cm:content:purplenotthereyet"); - restClient.assertStatusCodeIs(HttpStatus.OK); - String beforeAnything = "purplenotthereyet entries: " + responsePBQ.getEntries().size(); - if (responsePBQ.getEntries().size() != 0) - { - String msg = "Name: " + responsePBQ.getEntryByIndex(0).getName(); - String content = " Content: " + responsePBQ.getEntryByIndex(0).getContent().toString(); - Assert.assertEquals( beforeAnything, msg + content); - } - Assert.assertEquals( beforeAnything, "purplenotthereyet entries: 0"); + FileModel updateableFile; + String originalText = GUID.generate(); + String newText = GUID.generate(); - SearchResponse response4 = queryAsUser(testUser, "cm:content:brown"); - restClient.assertStatusCodeIs(HttpStatus.OK); - response4.assertThat().entriesListIsNotEmpty(); + // Create test file to be accessed only by this test method to avoid inconsistency when querying updates + String filename = "File-" + originalText + ".txt"; + String title = "Title: File for testing by testSearchUpdateContent only"; + String description = "Description: Contains updatable unique string to test query after content update: "; + updateableFile = new FileModel(filename, title, description, FileType.TEXT_PLAIN, + description + originalText + " is a unique string"); + dataContent.usingUser(testUser).usingSite(testSite).usingResource(folder).createContent(updateableFile); + Assert.assertTrue(waitForContentIndexing(originalText, true)); - //TODO: remove - temp check for debugging - SearchResponse responsePAQ = queryAsUser(testUser, "cm:content:purplenotthereyet"); + // Verify that 1 occurrence of the original text is found + SearchResponse response1 = queryAsUser(testUser, "cm:content:" + originalText); restClient.assertStatusCodeIs(HttpStatus.OK); - String afterQuery = "purplenotthereyet entries after query: " + responsePAQ.getEntries().size(); - Assert.assertEquals(afterQuery, "purplenotthereyet entries after query: 0"); + Assert.assertEquals(response1.getEntries().size(), 1, "Expected 1 original text before update"); - String newContent = "The quick purple fox jumps over the lazy dog"; - dataContent.usingUser(adminUserModel).usingSite(testSite).usingResource(file) + // Verify that 0 occurrences of the replacement text are found + SearchResponse response2 = queryAsUser(testUser, "cm:content:" + newText); + restClient.assertStatusCodeIs(HttpStatus.OK); + Assert.assertEquals(response2.getEntries().size(), 0, "Expected 0 new text before update"); + + // Update the content + String newContent = description + newText + " is a unique string"; + dataContent.usingUser(adminUserModel).usingSite(testSite).usingResource(updateableFile) .updateContent(newContent); - Assert.assertTrue(waitForContentIndexing("purple", true)); + Assert.assertTrue(waitForContentIndexing(newText, true)); - //TODO: remove - artificially long wait for debugging - Utility.waitToLoopTime(60); - - SearchResponse response5 = queryAsUser(testUser, "cm:content:brown"); + // Verify that 0 occurrences of the original text are found + SearchResponse response3 = queryAsUser(testUser, "cm:content:" + originalText); restClient.assertStatusCodeIs(HttpStatus.OK); + Assert.assertEquals(response3.getEntries().size(), 0, "Expected 0 original text after update"); - //TODO: remove - temp check for debugging - SearchResponse responseRA = queryAsUser(testUser, "cm:content:purple"); + // Verify that 1 occurrence of the replacement text is found + SearchResponse response4 = queryAsUser(testUser, "cm:content:" + newText); restClient.assertStatusCodeIs(HttpStatus.OK); - String afterUpdate = "brown entries: " + response5.getEntries().size() + " purple entries: " + responseRA.getEntries().size(); - Assert.assertEquals(afterUpdate, "brown entries: 0 purple entries: 1"); - - int initialEntriesSize = response4.getEntries().size(); - response5.assertThat().entriesListCountIs( initialEntriesSize - 1); + Assert.assertEquals(response4.getEntries().size(), 1, "Expected 1 new text before update"); } @Test(priority=6) From 9162f05b5e224ede203dd8be82ec9d2744f759f9 Mon Sep 17 00:00:00 2001 From: Sara Aspery Date: Wed, 30 Nov 2022 03:10:44 +0000 Subject: [PATCH 13/27] Use system time for content string --- .../functional/searchServices/search/SearchCasesTest.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java index 94a017547..bf04fcdb2 100644 --- a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java +++ b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java @@ -29,7 +29,6 @@ import org.alfresco.rest.search.RestRequestQueryModel; import org.alfresco.rest.search.RestResultBucketsModel; import org.alfresco.rest.search.SearchRequest; import org.alfresco.rest.search.SearchResponse; -import org.alfresco.util.GUID; import org.alfresco.utility.model.FileModel; import org.alfresco.utility.model.FileType; import org.hamcrest.Matchers; @@ -106,8 +105,8 @@ public class SearchCasesTest extends AbstractSearchServicesE2ETest public void testSearchUpdateContent() { FileModel updateableFile; - String originalText = GUID.generate(); - String newText = GUID.generate(); + String originalText = String.valueOf(System.currentTimeMillis()); + String newText = String.valueOf(System.currentTimeMillis() + 300000); // Create test file to be accessed only by this test method to avoid inconsistency when querying updates String filename = "File-" + originalText + ".txt"; From 7b0ed0a492caf7b919d570cf7dcc93921e4b81f0 Mon Sep 17 00:00:00 2001 From: Sara Aspery Date: Thu, 1 Dec 2022 15:43:31 +0000 Subject: [PATCH 14/27] Create unique file for search with facet fields test --- .../search/AbstractSearchServicesE2ETest.java | 26 ++++++++++++++----- .../search/SearchCasesTest.java | 22 +++++++--------- 2 files changed, 29 insertions(+), 19 deletions(-) diff --git a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/AbstractSearchServicesE2ETest.java b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/AbstractSearchServicesE2ETest.java index cdbac2f77..ead9c7565 100644 --- a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/AbstractSearchServicesE2ETest.java +++ b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/AbstractSearchServicesE2ETest.java @@ -4,21 +4,21 @@ * %% * Copyright (C) 2005 - 2022 Alfresco Software Limited * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is * provided under the following open source license terms: - * + * * Alfresco is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * Alfresco is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public License * along with Alfresco. If not, see . * #L% @@ -30,6 +30,7 @@ import org.alfresco.test.search.functional.AbstractE2EFunctionalTest; import org.alfresco.utility.model.FileModel; import org.alfresco.utility.model.FileType; import org.alfresco.utility.model.FolderModel; +import org.testng.Assert; import static java.util.List.of; @@ -83,8 +84,19 @@ public abstract class AbstractSearchServicesE2ETest extends AbstractE2EFunctiona of(file, file2, file3, file4).forEach( f -> dataContent.usingUser(testUser).usingSite(testSite).usingResource(folder).createContent(f) - ); + ); waitForMetadataIndexing(file4.getName(), true); } + + protected FileModel createFileWithProvidedText(String filename, String providedText) + { + String title = "Title: File containing " + providedText; + String description = "Description: Contains provided string: " + providedText; + FileModel uniqueFile = new FileModel(filename, title, description, FileType.TEXT_PLAIN, + "The content " + providedText + " is a provided string"); + dataContent.usingUser(testUser).usingSite(testSite).usingResource(folder).createContent(uniqueFile); + Assert.assertTrue(waitForContentIndexing(providedText, true)); + return uniqueFile; + } } diff --git a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java index bf04fcdb2..644b1baab 100644 --- a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java +++ b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java @@ -104,18 +104,11 @@ public class SearchCasesTest extends AbstractSearchServicesE2ETest @Test(priority=5) public void testSearchUpdateContent() { - FileModel updateableFile; String originalText = String.valueOf(System.currentTimeMillis()); String newText = String.valueOf(System.currentTimeMillis() + 300000); - // Create test file to be accessed only by this test method to avoid inconsistency when querying updates - String filename = "File-" + originalText + ".txt"; - String title = "Title: File for testing by testSearchUpdateContent only"; - String description = "Description: Contains updatable unique string to test query after content update: "; - updateableFile = new FileModel(filename, title, description, FileType.TEXT_PLAIN, - description + originalText + " is a unique string"); - dataContent.usingUser(testUser).usingSite(testSite).usingResource(folder).createContent(updateableFile); - Assert.assertTrue(waitForContentIndexing(originalText, true)); + // Create test file to be accessed only by this test method to avoid inconsistent results when querying updates + FileModel updateableFile = createFileWithProvidedText(originalText + ".txt", originalText); // Verify that 1 occurrence of the original text is found SearchResponse response1 = queryAsUser(testUser, "cm:content:" + originalText); @@ -128,7 +121,7 @@ public class SearchCasesTest extends AbstractSearchServicesE2ETest Assert.assertEquals(response2.getEntries().size(), 0, "Expected 0 new text before update"); // Update the content - String newContent = description + newText + " is a unique string"; + String newContent = "Description: Contains provided string: " + newText; dataContent.usingUser(adminUserModel).usingSite(testSite).usingResource(updateableFile) .updateContent(newContent); Assert.assertTrue(waitForContentIndexing(newText, true)); @@ -209,9 +202,14 @@ public class SearchCasesTest extends AbstractSearchServicesE2ETest @Test(priority=10) public void searchWithFacedFields() { + String uniqueText = String.valueOf(System.currentTimeMillis()); + + // Create test file to be accessed only by this test method to avoid inconsistent results + createFileWithProvidedText(uniqueText + ".ODT", uniqueText); + SearchRequest query = new SearchRequest(); RestRequestQueryModel queryReq = new RestRequestQueryModel(); - queryReq.setQuery("cm:content:unique"); + queryReq.setQuery("cm:content:" + uniqueText); query.setQuery(queryReq); RestRequestFacetFieldsModel facetFields = new RestRequestFacetFieldsModel(); @@ -236,7 +234,7 @@ public class SearchCasesTest extends AbstractSearchServicesE2ETest bucket1.assertThat().field("label").is(testUser.getUsername()); bucket1.assertThat().field("display").is("FN-" + testUser.getUsername() + " LN-" + testUser.getUsername()); bucket1.assertThat().field("filterQuery").is("modifier:\"" + testUser.getUsername() + "\""); - bucket1.assertThat().field("count").isGreaterThan(0); + bucket1.assertThat().field("count").is(1); } @Test(priority=12) From bece9206284c8f76461d01878352ac93143963f8 Mon Sep 17 00:00:00 2001 From: Sara Aspery Date: Thu, 1 Dec 2022 23:19:44 +0000 Subject: [PATCH 15/27] Add sleep then retry for content indexing completed check in tests --- .../functional/searchServices/search/SearchCasesTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java index 644b1baab..429c45206 100644 --- a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java +++ b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java @@ -102,7 +102,7 @@ public class SearchCasesTest extends AbstractSearchServicesE2ETest } @Test(priority=5) - public void testSearchUpdateContent() + public void testSearchUpdateContent() throws InterruptedException { String originalText = String.valueOf(System.currentTimeMillis()); String newText = String.valueOf(System.currentTimeMillis() + 300000); @@ -200,7 +200,7 @@ public class SearchCasesTest extends AbstractSearchServicesE2ETest * } */ @Test(priority=10) - public void searchWithFacedFields() + public void searchWithFacedFields() throws InterruptedException { String uniqueText = String.valueOf(System.currentTimeMillis()); From fa1a59a2150e74193dad7f892820921ba15d2807 Mon Sep 17 00:00:00 2001 From: Sara Aspery Date: Thu, 1 Dec 2022 23:20:07 +0000 Subject: [PATCH 16/27] Add sleep then retry for content indexing completed check in tests --- .../search/AbstractSearchServicesE2ETest.java | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/AbstractSearchServicesE2ETest.java b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/AbstractSearchServicesE2ETest.java index ead9c7565..e8d295ceb 100644 --- a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/AbstractSearchServicesE2ETest.java +++ b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/AbstractSearchServicesE2ETest.java @@ -27,10 +27,12 @@ package org.alfresco.test.search.functional.searchServices.search; import org.alfresco.test.search.functional.AbstractE2EFunctionalTest; +import org.alfresco.utility.Utility; import org.alfresco.utility.model.FileModel; import org.alfresco.utility.model.FileType; import org.alfresco.utility.model.FolderModel; import org.testng.Assert; +import org.testng.annotations.BeforeClass; import static java.util.List.of; @@ -48,10 +50,15 @@ public abstract class AbstractSearchServicesE2ETest extends AbstractE2EFunctiona { private static final String SEARCH_DATA_SAMPLE_FOLDER = "FolderSearch"; + /** The maximum time to wait for content indexing to complete (in ms). */ + private static final int MAX_TIME = 120 * 1000; + /** The frequency to check the report (in ms). */ + private static final int RETRY_INTERVAL = 30000; + protected FileModel file, file2, file3, file4; protected FolderModel folder; - public void searchServicesDataPreparation() + public void searchServicesDataPreparation() throws InterruptedException { /* * Create the following file structure for preconditions : @@ -86,17 +93,23 @@ public abstract class AbstractSearchServicesE2ETest extends AbstractE2EFunctiona f -> dataContent.usingUser(testUser).usingSite(testSite).usingResource(folder).createContent(f) ); - waitForMetadataIndexing(file4.getName(), true); + Utility.sleep(RETRY_INTERVAL, MAX_TIME, () -> { + waitForMetadataIndexing(file4.getName(), true); + }); } - protected FileModel createFileWithProvidedText(String filename, String providedText) + protected FileModel createFileWithProvidedText(String filename, String providedText) throws InterruptedException { String title = "Title: File containing " + providedText; String description = "Description: Contains provided string: " + providedText; FileModel uniqueFile = new FileModel(filename, title, description, FileType.TEXT_PLAIN, "The content " + providedText + " is a provided string"); dataContent.usingUser(testUser).usingSite(testSite).usingResource(folder).createContent(uniqueFile); - Assert.assertTrue(waitForContentIndexing(providedText, true)); + + Utility.sleep(RETRY_INTERVAL, MAX_TIME, () -> { + Assert.assertTrue(waitForContentIndexing(providedText, true)); + }); + return uniqueFile; } } From 260914c979d81f03149cdf5f8ea1315f50f65abe Mon Sep 17 00:00:00 2001 From: Sara Aspery Date: Fri, 2 Dec 2022 07:56:26 +0000 Subject: [PATCH 17/27] Remove extra sleep and double retry attempts --- .../search/functional/AbstractE2EFunctionalTest.java | 2 +- .../search/AbstractSearchServicesE2ETest.java | 12 ++---------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/e2e-test/src/test/java/org/alfresco/test/search/functional/AbstractE2EFunctionalTest.java b/e2e-test/src/test/java/org/alfresco/test/search/functional/AbstractE2EFunctionalTest.java index 81dd4430b..7a26b8b7d 100644 --- a/e2e-test/src/test/java/org/alfresco/test/search/functional/AbstractE2EFunctionalTest.java +++ b/e2e-test/src/test/java/org/alfresco/test/search/functional/AbstractE2EFunctionalTest.java @@ -83,7 +83,7 @@ import com.fasterxml.jackson.core.JsonProcessingException; public abstract class AbstractE2EFunctionalTest extends AbstractTestNGSpringContextTests { /** The number of retries that a query will be tried before giving up. */ - protected static final int SEARCH_MAX_ATTEMPTS = 60; + protected static final int SEARCH_MAX_ATTEMPTS = 120; private static final Logger LOGGER = LogFactory.getLogger(); diff --git a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/AbstractSearchServicesE2ETest.java b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/AbstractSearchServicesE2ETest.java index e8d295ceb..9bc8ca2ce 100644 --- a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/AbstractSearchServicesE2ETest.java +++ b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/AbstractSearchServicesE2ETest.java @@ -27,12 +27,10 @@ package org.alfresco.test.search.functional.searchServices.search; import org.alfresco.test.search.functional.AbstractE2EFunctionalTest; -import org.alfresco.utility.Utility; import org.alfresco.utility.model.FileModel; import org.alfresco.utility.model.FileType; import org.alfresco.utility.model.FolderModel; import org.testng.Assert; -import org.testng.annotations.BeforeClass; import static java.util.List.of; @@ -92,10 +90,7 @@ public abstract class AbstractSearchServicesE2ETest extends AbstractE2EFunctiona of(file, file2, file3, file4).forEach( f -> dataContent.usingUser(testUser).usingSite(testSite).usingResource(folder).createContent(f) ); - - Utility.sleep(RETRY_INTERVAL, MAX_TIME, () -> { - waitForMetadataIndexing(file4.getName(), true); - }); + waitForMetadataIndexing(file4.getName(), true); } protected FileModel createFileWithProvidedText(String filename, String providedText) throws InterruptedException @@ -105,10 +100,7 @@ public abstract class AbstractSearchServicesE2ETest extends AbstractE2EFunctiona FileModel uniqueFile = new FileModel(filename, title, description, FileType.TEXT_PLAIN, "The content " + providedText + " is a provided string"); dataContent.usingUser(testUser).usingSite(testSite).usingResource(folder).createContent(uniqueFile); - - Utility.sleep(RETRY_INTERVAL, MAX_TIME, () -> { - Assert.assertTrue(waitForContentIndexing(providedText, true)); - }); + Assert.assertTrue(waitForContentIndexing(providedText, true)); return uniqueFile; } From 6225430cb26e27b638c1786b4f1613fe977e0386 Mon Sep 17 00:00:00 2001 From: Elia Porciani Date: Mon, 5 Dec 2022 17:31:25 +0100 Subject: [PATCH 18/27] Fix/acs 4090 (#1594) Fix queries with colon in predicate values --- .../alfrescoModels/cm.contentmodel.1505615645.xml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/search-services/alfresco-search/src/test/resources/test-files/alfrescoModels/cm.contentmodel.1505615645.xml b/search-services/alfresco-search/src/test/resources/test-files/alfrescoModels/cm.contentmodel.1505615645.xml index 1a29cf731..6109ff964 100644 --- a/search-services/alfresco-search/src/test/resources/test-files/alfrescoModels/cm.contentmodel.1505615645.xml +++ b/search-services/alfresco-search/src/test/resources/test-files/alfrescoModels/cm.contentmodel.1505615645.xml @@ -1829,6 +1829,17 @@ false + + Track Number + d:text + false + + true + true + false + false + + Release Date d:date From ce522fec44750eeb1093d14b04f149d607238e20 Mon Sep 17 00:00:00 2001 From: Travis CI User Date: Tue, 6 Dec 2022 08:18:01 +0000 Subject: [PATCH 19/27] [maven-release-plugin][skip ci]prepare release 2.0.6-A3 --- e2e-test/pom.xml | 2 +- pom.xml | 4 ++-- search-services/alfresco-search/pom.xml | 4 ++-- search-services/alfresco-solrclient-lib/pom.xml | 2 +- search-services/packaging/pom.xml | 2 +- search-services/pom.xml | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/e2e-test/pom.xml b/e2e-test/pom.xml index eb27c4090..a56a1eccc 100644 --- a/e2e-test/pom.xml +++ b/e2e-test/pom.xml @@ -3,7 +3,7 @@ org.alfresco alfresco-search-and-insight-parent - 2.0.6-SNAPSHOT + 2.0.6-A3 org.alfresco search-analytics-e2e-test diff --git a/pom.xml b/pom.xml index cb5ca8c83..ee9c78e8e 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ 12 alfresco-search-and-insight-parent - 2.0.6-SNAPSHOT + 2.0.6-A3 pom Alfresco Search And Insight Engine @@ -38,7 +38,7 @@ scm:git:https://github.com/Alfresco/InsightEngine.git scm:git:https://github.com/Alfresco/InsightEngine.git https://github.com/Alfresco/InsightEngine - HEAD + 2.0.6-A3 11 diff --git a/search-services/alfresco-search/pom.xml b/search-services/alfresco-search/pom.xml index 9b036bca1..59b4c573f 100644 --- a/search-services/alfresco-search/pom.xml +++ b/search-services/alfresco-search/pom.xml @@ -6,7 +6,7 @@ org.alfresco alfresco-search-parent - 2.0.6-SNAPSHOT + 2.0.6-A3 ../pom.xml @@ -15,7 +15,7 @@ org.alfresco alfresco-solrclient-lib - 2.0.6-SNAPSHOT + 2.0.6-A3 servlet-api diff --git a/search-services/alfresco-solrclient-lib/pom.xml b/search-services/alfresco-solrclient-lib/pom.xml index bfddbc81e..a3d3f56ea 100644 --- a/search-services/alfresco-solrclient-lib/pom.xml +++ b/search-services/alfresco-solrclient-lib/pom.xml @@ -7,7 +7,7 @@ org.alfresco alfresco-search-parent - 2.0.6-SNAPSHOT + 2.0.6-A3 diff --git a/search-services/packaging/pom.xml b/search-services/packaging/pom.xml index 722d8a0c5..3a61ad96c 100644 --- a/search-services/packaging/pom.xml +++ b/search-services/packaging/pom.xml @@ -12,7 +12,7 @@ org.alfresco alfresco-search-parent - 2.0.6-SNAPSHOT + 2.0.6-A3 ../pom.xml diff --git a/search-services/pom.xml b/search-services/pom.xml index cbdd17cdb..5d5548565 100644 --- a/search-services/pom.xml +++ b/search-services/pom.xml @@ -4,10 +4,10 @@ org.alfresco alfresco-search-and-insight-parent - 2.0.6-SNAPSHOT + 2.0.6-A3 alfresco-search-parent - 2.0.6-SNAPSHOT + 2.0.6-A3 pom Alfresco Solr Search parent From 6067fc69f3ee6e53c9a6be64bb33734de15bbb1e Mon Sep 17 00:00:00 2001 From: Travis CI User Date: Tue, 6 Dec 2022 08:18:04 +0000 Subject: [PATCH 20/27] [maven-release-plugin][skip ci]prepare for next development iteration --- e2e-test/pom.xml | 2 +- pom.xml | 4 ++-- search-services/alfresco-search/pom.xml | 4 ++-- search-services/alfresco-solrclient-lib/pom.xml | 2 +- search-services/packaging/pom.xml | 2 +- search-services/pom.xml | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/e2e-test/pom.xml b/e2e-test/pom.xml index a56a1eccc..eb27c4090 100644 --- a/e2e-test/pom.xml +++ b/e2e-test/pom.xml @@ -3,7 +3,7 @@ org.alfresco alfresco-search-and-insight-parent - 2.0.6-A3 + 2.0.6-SNAPSHOT org.alfresco search-analytics-e2e-test diff --git a/pom.xml b/pom.xml index ee9c78e8e..cb5ca8c83 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ 12 alfresco-search-and-insight-parent - 2.0.6-A3 + 2.0.6-SNAPSHOT pom Alfresco Search And Insight Engine @@ -38,7 +38,7 @@ scm:git:https://github.com/Alfresco/InsightEngine.git scm:git:https://github.com/Alfresco/InsightEngine.git https://github.com/Alfresco/InsightEngine - 2.0.6-A3 + HEAD 11 diff --git a/search-services/alfresco-search/pom.xml b/search-services/alfresco-search/pom.xml index 59b4c573f..9b036bca1 100644 --- a/search-services/alfresco-search/pom.xml +++ b/search-services/alfresco-search/pom.xml @@ -6,7 +6,7 @@ org.alfresco alfresco-search-parent - 2.0.6-A3 + 2.0.6-SNAPSHOT ../pom.xml @@ -15,7 +15,7 @@ org.alfresco alfresco-solrclient-lib - 2.0.6-A3 + 2.0.6-SNAPSHOT servlet-api diff --git a/search-services/alfresco-solrclient-lib/pom.xml b/search-services/alfresco-solrclient-lib/pom.xml index a3d3f56ea..bfddbc81e 100644 --- a/search-services/alfresco-solrclient-lib/pom.xml +++ b/search-services/alfresco-solrclient-lib/pom.xml @@ -7,7 +7,7 @@ org.alfresco alfresco-search-parent - 2.0.6-A3 + 2.0.6-SNAPSHOT diff --git a/search-services/packaging/pom.xml b/search-services/packaging/pom.xml index 3a61ad96c..722d8a0c5 100644 --- a/search-services/packaging/pom.xml +++ b/search-services/packaging/pom.xml @@ -12,7 +12,7 @@ org.alfresco alfresco-search-parent - 2.0.6-A3 + 2.0.6-SNAPSHOT ../pom.xml diff --git a/search-services/pom.xml b/search-services/pom.xml index 5d5548565..cbdd17cdb 100644 --- a/search-services/pom.xml +++ b/search-services/pom.xml @@ -4,10 +4,10 @@ org.alfresco alfresco-search-and-insight-parent - 2.0.6-A3 + 2.0.6-SNAPSHOT alfresco-search-parent - 2.0.6-A3 + 2.0.6-SNAPSHOT pom Alfresco Solr Search parent From 362fa8a7a912aa453369f6e43df5e1dad3743653 Mon Sep 17 00:00:00 2001 From: Elia Porciani Date: Tue, 6 Dec 2022 14:23:41 +0100 Subject: [PATCH 21/27] [ACS-3597] (#1599) update alfresco_data_model dependency version --- pom.xml | 7 +----- .../alfresco-solrclient-lib/pom.xml | 10 +++----- .../src/main/resources/licenses/notice.txt | 25 ++++++++++--------- 3 files changed, 17 insertions(+), 25 deletions(-) diff --git a/pom.xml b/pom.xml index cb5ca8c83..c1f97c1f0 100644 --- a/pom.xml +++ b/pom.xml @@ -55,7 +55,7 @@ false 1.3 - 13.4 + 17.141 2.13.4 2.13.4.2 @@ -264,11 +264,6 @@ org.restlet.ext.servlet ${dependency.restlet.version} - - org.jdom - jdom2 - ${dependency.jdom2.version} - org.apache.httpcomponents diff --git a/search-services/alfresco-solrclient-lib/pom.xml b/search-services/alfresco-solrclient-lib/pom.xml index bfddbc81e..8e5d4895b 100644 --- a/search-services/alfresco-solrclient-lib/pom.xml +++ b/search-services/alfresco-solrclient-lib/pom.xml @@ -22,19 +22,15 @@ org.apache.tika - tika-core + * log4j log4j - org.apache.tika - tika-core - - - org.apache.tika - tika-parsers + com.zaxxer + SparseBitSet diff --git a/search-services/packaging/src/main/resources/licenses/notice.txt b/search-services/packaging/src/main/resources/licenses/notice.txt index ee035d7aa..fea181827 100644 --- a/search-services/packaging/src/main/resources/licenses/notice.txt +++ b/search-services/packaging/src/main/resources/licenses/notice.txt @@ -15,16 +15,16 @@ The Apache Lucene project page is https://lucene.apache.org/ wsdl4j-1.6.3.jar http://sourceforge.net/projects/wsdl4j === BSD 3 === -antlr-runtime-3.5.2.jar http://www.antlr.org/ -ST4-4.0.8.jar https://www.stringtemplate.org/license.html -antlr-3.5.2.jar http://www.antlr.org/ +antlr-runtime-3.5.3.jar http://www.antlr.org/ +ST4-4.3.1.jar https://www.stringtemplate.org/license.html +antlr-3.5.3.jar http://www.antlr.org/ jaxen-1.2.0.jar http://www.cafeconleche.org/jaxen/ === BSD variant License === xpp3-1.1.4c.jar http://www.extreme.indiana.edu/dist/java-repository/xpp3/licenses/LICENSE.txt === JSON === -json-20210307.jar https://github.com/stleary/JSON-java +json-20220320.jar https://github.com/stleary/JSON-java === Apache 2.0 === error_prone_annotations-2.11.0.jar https://github.com/google/error-prone @@ -65,14 +65,14 @@ jackson-core-2.13.4.jar https://github.com/FasterXML/jackson jackson-annotations-2.13.4.jar https://github.com/FasterXML/jackson jackson-databind-2.13.4.2.jar https://github.com/FasterXML/jackson commons-httpclient-3.1-HTTPCLIENT-1265.jar http://jakarta.apache.org/commons/ -spring-aop-5.3.18.jar http://projects.spring.io/spring-framework/ -spring-beans-5.3.18.jar http://projects.spring.io/spring-framework/ -spring-context-5.3.18.jar http://projects.spring.io/spring-framework/ -spring-core-5.3.18.jar http://projects.spring.io/spring-framework/ -spring-expression-5.3.18.jar http://projects.spring.io/spring-framework/ -spring-jdbc-5.3.18.jar http://projects.spring.io/spring-framework/ -spring-orm-5.3.18.jar http://projects.spring.io/spring-framework/ -spring-tx-5.3.18.jar http://projects.spring.io/spring-framework/ +spring-aop-5.3.23.jar http://projects.spring.io/spring-framework/ +spring-beans-5.3.23.jar http://projects.spring.io/spring-framework/ +spring-context-5.3.23.jar http://projects.spring.io/spring-framework/ +spring-core-5.3.23.jar http://projects.spring.io/spring-framework/ +spring-expression-5.3.23.jar http://projects.spring.io/spring-framework/ +spring-jdbc-5.3.23.jar http://projects.spring.io/spring-framework/ +spring-orm-5.3.23.jar http://projects.spring.io/spring-framework/ +spring-tx-5.3.23.jar http://projects.spring.io/spring-framework/ guessencoding-1.4.jar http://docs.codehaus.org/display/GUESSENC/ jug-2.0.0-asl.jar http://jug.safehaus.org/ acegi-security-0.8.2_patched.jar http://sourceforge.net/projects/acegisecurity/ @@ -98,6 +98,7 @@ simple-xml-safe-2.7.1.jar https://github.com/carrotsearch/simplexml-safe/blob/re reload4j-1.2.18.3.jar http://www.apache.org/licenses/LICENSE-2.0.txt jackson-core-asl-1.9.14-atlassian-6.jar http://www.apache.org/licenses/LICENSE-2.0.txt jackson-mapper-asl-1.9.14-atlassian-6.jar http://www.apache.org/licenses/LICENSE-2.0.txt +gson-2.8.9.jar https://github.com/google/gson/blob/gson-parent-2.8.9/LICENSE === CDDL 1.1 === From f9c92cc4b4e45f2f032a00c690be13c9c325e96a Mon Sep 17 00:00:00 2001 From: Travis CI User Date: Tue, 6 Dec 2022 14:25:38 +0000 Subject: [PATCH 22/27] [maven-release-plugin][skip ci]prepare release 2.0.6-A4 --- e2e-test/pom.xml | 2 +- pom.xml | 4 ++-- search-services/alfresco-search/pom.xml | 4 ++-- search-services/alfresco-solrclient-lib/pom.xml | 2 +- search-services/packaging/pom.xml | 2 +- search-services/pom.xml | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/e2e-test/pom.xml b/e2e-test/pom.xml index eb27c4090..10db33609 100644 --- a/e2e-test/pom.xml +++ b/e2e-test/pom.xml @@ -3,7 +3,7 @@ org.alfresco alfresco-search-and-insight-parent - 2.0.6-SNAPSHOT + 2.0.6-A4 org.alfresco search-analytics-e2e-test diff --git a/pom.xml b/pom.xml index c1f97c1f0..d3ab8a283 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ 12 alfresco-search-and-insight-parent - 2.0.6-SNAPSHOT + 2.0.6-A4 pom Alfresco Search And Insight Engine @@ -38,7 +38,7 @@ scm:git:https://github.com/Alfresco/InsightEngine.git scm:git:https://github.com/Alfresco/InsightEngine.git https://github.com/Alfresco/InsightEngine - HEAD + 2.0.6-A4 11 diff --git a/search-services/alfresco-search/pom.xml b/search-services/alfresco-search/pom.xml index 9b036bca1..cf7588efc 100644 --- a/search-services/alfresco-search/pom.xml +++ b/search-services/alfresco-search/pom.xml @@ -6,7 +6,7 @@ org.alfresco alfresco-search-parent - 2.0.6-SNAPSHOT + 2.0.6-A4 ../pom.xml @@ -15,7 +15,7 @@ org.alfresco alfresco-solrclient-lib - 2.0.6-SNAPSHOT + 2.0.6-A4 servlet-api diff --git a/search-services/alfresco-solrclient-lib/pom.xml b/search-services/alfresco-solrclient-lib/pom.xml index 8e5d4895b..1e9e0d691 100644 --- a/search-services/alfresco-solrclient-lib/pom.xml +++ b/search-services/alfresco-solrclient-lib/pom.xml @@ -7,7 +7,7 @@ org.alfresco alfresco-search-parent - 2.0.6-SNAPSHOT + 2.0.6-A4 diff --git a/search-services/packaging/pom.xml b/search-services/packaging/pom.xml index 722d8a0c5..0186be06f 100644 --- a/search-services/packaging/pom.xml +++ b/search-services/packaging/pom.xml @@ -12,7 +12,7 @@ org.alfresco alfresco-search-parent - 2.0.6-SNAPSHOT + 2.0.6-A4 ../pom.xml diff --git a/search-services/pom.xml b/search-services/pom.xml index cbdd17cdb..12e2ebce8 100644 --- a/search-services/pom.xml +++ b/search-services/pom.xml @@ -4,10 +4,10 @@ org.alfresco alfresco-search-and-insight-parent - 2.0.6-SNAPSHOT + 2.0.6-A4 alfresco-search-parent - 2.0.6-SNAPSHOT + 2.0.6-A4 pom Alfresco Solr Search parent From 1b31471e23ebee230692620c4ffe68195659d368 Mon Sep 17 00:00:00 2001 From: Travis CI User Date: Tue, 6 Dec 2022 14:25:41 +0000 Subject: [PATCH 23/27] [maven-release-plugin][skip ci]prepare for next development iteration --- e2e-test/pom.xml | 2 +- pom.xml | 4 ++-- search-services/alfresco-search/pom.xml | 4 ++-- search-services/alfresco-solrclient-lib/pom.xml | 2 +- search-services/packaging/pom.xml | 2 +- search-services/pom.xml | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/e2e-test/pom.xml b/e2e-test/pom.xml index 10db33609..eb27c4090 100644 --- a/e2e-test/pom.xml +++ b/e2e-test/pom.xml @@ -3,7 +3,7 @@ org.alfresco alfresco-search-and-insight-parent - 2.0.6-A4 + 2.0.6-SNAPSHOT org.alfresco search-analytics-e2e-test diff --git a/pom.xml b/pom.xml index d3ab8a283..c1f97c1f0 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ 12 alfresco-search-and-insight-parent - 2.0.6-A4 + 2.0.6-SNAPSHOT pom Alfresco Search And Insight Engine @@ -38,7 +38,7 @@ scm:git:https://github.com/Alfresco/InsightEngine.git scm:git:https://github.com/Alfresco/InsightEngine.git https://github.com/Alfresco/InsightEngine - 2.0.6-A4 + HEAD 11 diff --git a/search-services/alfresco-search/pom.xml b/search-services/alfresco-search/pom.xml index cf7588efc..9b036bca1 100644 --- a/search-services/alfresco-search/pom.xml +++ b/search-services/alfresco-search/pom.xml @@ -6,7 +6,7 @@ org.alfresco alfresco-search-parent - 2.0.6-A4 + 2.0.6-SNAPSHOT ../pom.xml @@ -15,7 +15,7 @@ org.alfresco alfresco-solrclient-lib - 2.0.6-A4 + 2.0.6-SNAPSHOT servlet-api diff --git a/search-services/alfresco-solrclient-lib/pom.xml b/search-services/alfresco-solrclient-lib/pom.xml index 1e9e0d691..8e5d4895b 100644 --- a/search-services/alfresco-solrclient-lib/pom.xml +++ b/search-services/alfresco-solrclient-lib/pom.xml @@ -7,7 +7,7 @@ org.alfresco alfresco-search-parent - 2.0.6-A4 + 2.0.6-SNAPSHOT diff --git a/search-services/packaging/pom.xml b/search-services/packaging/pom.xml index 0186be06f..722d8a0c5 100644 --- a/search-services/packaging/pom.xml +++ b/search-services/packaging/pom.xml @@ -12,7 +12,7 @@ org.alfresco alfresco-search-parent - 2.0.6-A4 + 2.0.6-SNAPSHOT ../pom.xml diff --git a/search-services/pom.xml b/search-services/pom.xml index 12e2ebce8..cbdd17cdb 100644 --- a/search-services/pom.xml +++ b/search-services/pom.xml @@ -4,10 +4,10 @@ org.alfresco alfresco-search-and-insight-parent - 2.0.6-A4 + 2.0.6-SNAPSHOT alfresco-search-parent - 2.0.6-A4 + 2.0.6-SNAPSHOT pom Alfresco Solr Search parent From 1fd16e459259aea543dc890d9ea72c18a8d7e5c6 Mon Sep 17 00:00:00 2001 From: Travis CI User Date: Thu, 15 Dec 2022 11:02:15 +0000 Subject: [PATCH 24/27] [maven-release-plugin][skip ci]prepare release 2.0.6 --- e2e-test/pom.xml | 2 +- pom.xml | 4 ++-- search-services/alfresco-search/pom.xml | 4 ++-- search-services/alfresco-solrclient-lib/pom.xml | 2 +- search-services/packaging/pom.xml | 2 +- search-services/pom.xml | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/e2e-test/pom.xml b/e2e-test/pom.xml index eb27c4090..ab0db7e64 100644 --- a/e2e-test/pom.xml +++ b/e2e-test/pom.xml @@ -3,7 +3,7 @@ org.alfresco alfresco-search-and-insight-parent - 2.0.6-SNAPSHOT + 2.0.6 org.alfresco search-analytics-e2e-test diff --git a/pom.xml b/pom.xml index c1f97c1f0..b80f0cba1 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ 12 alfresco-search-and-insight-parent - 2.0.6-SNAPSHOT + 2.0.6 pom Alfresco Search And Insight Engine @@ -38,7 +38,7 @@ scm:git:https://github.com/Alfresco/InsightEngine.git scm:git:https://github.com/Alfresco/InsightEngine.git https://github.com/Alfresco/InsightEngine - HEAD + 2.0.6 11 diff --git a/search-services/alfresco-search/pom.xml b/search-services/alfresco-search/pom.xml index 9b036bca1..cde95ffb8 100644 --- a/search-services/alfresco-search/pom.xml +++ b/search-services/alfresco-search/pom.xml @@ -6,7 +6,7 @@ org.alfresco alfresco-search-parent - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml @@ -15,7 +15,7 @@ org.alfresco alfresco-solrclient-lib - 2.0.6-SNAPSHOT + 2.0.6 servlet-api diff --git a/search-services/alfresco-solrclient-lib/pom.xml b/search-services/alfresco-solrclient-lib/pom.xml index 8e5d4895b..cd93c3afa 100644 --- a/search-services/alfresco-solrclient-lib/pom.xml +++ b/search-services/alfresco-solrclient-lib/pom.xml @@ -7,7 +7,7 @@ org.alfresco alfresco-search-parent - 2.0.6-SNAPSHOT + 2.0.6 diff --git a/search-services/packaging/pom.xml b/search-services/packaging/pom.xml index 722d8a0c5..55832dc66 100644 --- a/search-services/packaging/pom.xml +++ b/search-services/packaging/pom.xml @@ -12,7 +12,7 @@ org.alfresco alfresco-search-parent - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml diff --git a/search-services/pom.xml b/search-services/pom.xml index cbdd17cdb..0fb33cbec 100644 --- a/search-services/pom.xml +++ b/search-services/pom.xml @@ -4,10 +4,10 @@ org.alfresco alfresco-search-and-insight-parent - 2.0.6-SNAPSHOT + 2.0.6 alfresco-search-parent - 2.0.6-SNAPSHOT + 2.0.6 pom Alfresco Solr Search parent From 2087d230970e4093e09ba06518c8e5d57f6bcf2a Mon Sep 17 00:00:00 2001 From: Travis CI User Date: Thu, 15 Dec 2022 11:02:17 +0000 Subject: [PATCH 25/27] [maven-release-plugin][skip ci]prepare for next development iteration --- e2e-test/pom.xml | 2 +- pom.xml | 4 ++-- search-services/alfresco-search/pom.xml | 4 ++-- search-services/alfresco-solrclient-lib/pom.xml | 2 +- search-services/packaging/pom.xml | 2 +- search-services/pom.xml | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/e2e-test/pom.xml b/e2e-test/pom.xml index ab0db7e64..30a4ce158 100644 --- a/e2e-test/pom.xml +++ b/e2e-test/pom.xml @@ -3,7 +3,7 @@ org.alfresco alfresco-search-and-insight-parent - 2.0.6 + 2.0.7-SNAPSHOT org.alfresco search-analytics-e2e-test diff --git a/pom.xml b/pom.xml index b80f0cba1..c62f07e2a 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ 12 alfresco-search-and-insight-parent - 2.0.6 + 2.0.7-SNAPSHOT pom Alfresco Search And Insight Engine @@ -38,7 +38,7 @@ scm:git:https://github.com/Alfresco/InsightEngine.git scm:git:https://github.com/Alfresco/InsightEngine.git https://github.com/Alfresco/InsightEngine - 2.0.6 + HEAD 11 diff --git a/search-services/alfresco-search/pom.xml b/search-services/alfresco-search/pom.xml index cde95ffb8..4c21c216f 100644 --- a/search-services/alfresco-search/pom.xml +++ b/search-services/alfresco-search/pom.xml @@ -6,7 +6,7 @@ org.alfresco alfresco-search-parent - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml @@ -15,7 +15,7 @@ org.alfresco alfresco-solrclient-lib - 2.0.6 + 2.0.7-SNAPSHOT servlet-api diff --git a/search-services/alfresco-solrclient-lib/pom.xml b/search-services/alfresco-solrclient-lib/pom.xml index cd93c3afa..0d90a4d3b 100644 --- a/search-services/alfresco-solrclient-lib/pom.xml +++ b/search-services/alfresco-solrclient-lib/pom.xml @@ -7,7 +7,7 @@ org.alfresco alfresco-search-parent - 2.0.6 + 2.0.7-SNAPSHOT diff --git a/search-services/packaging/pom.xml b/search-services/packaging/pom.xml index 55832dc66..a77133a4b 100644 --- a/search-services/packaging/pom.xml +++ b/search-services/packaging/pom.xml @@ -12,7 +12,7 @@ org.alfresco alfresco-search-parent - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml diff --git a/search-services/pom.xml b/search-services/pom.xml index 0fb33cbec..e63feeeea 100644 --- a/search-services/pom.xml +++ b/search-services/pom.xml @@ -4,10 +4,10 @@ org.alfresco alfresco-search-and-insight-parent - 2.0.6 + 2.0.7-SNAPSHOT alfresco-search-parent - 2.0.6 + 2.0.7-SNAPSHOT pom Alfresco Solr Search parent From 5e400d76c0aacbcca9eec219191606664e6daebf Mon Sep 17 00:00:00 2001 From: Sara Aspery Date: Mon, 19 Dec 2022 23:35:28 +0000 Subject: [PATCH 26/27] Removal of problematic tests from pipeline suite only --- .../search/SearchCasesTest.java | 204 +-------------- .../search/SearchSimpleCasesTest.java | 246 ++++++++++++++++++ e2e-test/src/test/resources/PipelineSuite.xml | 2 +- 3 files changed, 249 insertions(+), 203 deletions(-) create mode 100644 e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchSimpleCasesTest.java diff --git a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java index 429c45206..e7bc5d796 100644 --- a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java +++ b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java @@ -30,8 +30,6 @@ import org.alfresco.rest.search.RestResultBucketsModel; import org.alfresco.rest.search.SearchRequest; import org.alfresco.rest.search.SearchResponse; import org.alfresco.utility.model.FileModel; -import org.alfresco.utility.model.FileType; -import org.hamcrest.Matchers; import org.springframework.http.HttpStatus; import org.testng.Assert; import org.testng.annotations.BeforeClass; @@ -49,58 +47,6 @@ public class SearchCasesTest extends AbstractSearchServicesE2ETest Assert.assertTrue(waitForContentIndexing(file4.getContent(), true)); } - @Test(priority=1) - public void testSearchNameField() - { - SearchRequest searchReq = new SearchRequest(); - RestRequestQueryModel queryReq = new RestRequestQueryModel(); - queryReq.setQuery("cm:name:pangram"); - queryReq.setUserQuery("pangram"); - searchReq.setQuery(queryReq); - SearchResponse response = queryAsUser(testUser, "cm:name:pangram"); - restClient.assertStatusCodeIs(HttpStatus.OK); - response.assertThat().entriesListIsNotEmpty(); - } - - @Test(priority=2) - public void testSearchTitleField() - { - SearchRequest searchReq = new SearchRequest(); - RestRequestQueryModel queryReq = new RestRequestQueryModel(); - queryReq.setQuery("cm:title:cars"); - queryReq.setUserQuery("cars"); - searchReq.setQuery(queryReq); - SearchResponse response2 = queryAsUser(testUser, "cm:title:cars"); - restClient.assertStatusCodeIs(HttpStatus.OK); - response2.assertThat().entriesListIsNotEmpty(); - } - - @Test(priority=3) - public void testSearchDescriptionField() - { - SearchRequest searchReq = new SearchRequest(); - RestRequestQueryModel queryReq = new RestRequestQueryModel(); - queryReq.setQuery("cm:description:alfresco"); - queryReq.setUserQuery("alfresco"); - searchReq.setQuery(queryReq); - SearchResponse response3 = queryAsUser(testUser, "cm:description:alfresco"); - restClient.assertStatusCodeIs(HttpStatus.OK); - response3.assertThat().entriesListIsNotEmpty(); - } - - @Test(priority=4) - public void testSearchContentField() - { - SearchRequest searchReq = new SearchRequest(); - RestRequestQueryModel queryReq = new RestRequestQueryModel(); - queryReq.setQuery("cm:content:unique"); - queryReq.setUserQuery("unique"); - searchReq.setQuery(queryReq); - SearchResponse response4 = queryAsUser(testUser, "cm:content:unique"); - restClient.assertStatusCodeIs(HttpStatus.OK); - response4.assertThat().entriesListIsNotEmpty(); - } - @Test(priority=5) public void testSearchUpdateContent() throws InterruptedException { @@ -135,58 +81,9 @@ public class SearchCasesTest extends AbstractSearchServicesE2ETest SearchResponse response4 = queryAsUser(testUser, "cm:content:" + newText); restClient.assertStatusCodeIs(HttpStatus.OK); Assert.assertEquals(response4.getEntries().size(), 1, "Expected 1 new text before update"); - } - @Test(priority=6) - public void testSearchTextFile() - { - SearchRequest searchReq = new SearchRequest(); - RestRequestQueryModel queryReq = new RestRequestQueryModel(); - queryReq.setQuery("cm:name:pangram.txt"); - queryReq.setUserQuery("pangram.txt"); - searchReq.setQuery(queryReq); - SearchResponse response6 = queryAsUser(testUser, "cm:name:pangram.txt"); - restClient.assertStatusCodeIs(HttpStatus.OK); - response6.assertThat().entriesListIsNotEmpty(); - } - - @Test(priority=7) - public void testSearchPDFFile() - { - SearchRequest searchReq = new SearchRequest(); - RestRequestQueryModel queryReq = new RestRequestQueryModel(); - queryReq.setQuery("cm:name:cars.PDF"); - queryReq.setUserQuery("cars.PDF"); - searchReq.setQuery(queryReq); - SearchResponse response6 = queryAsUser(testUser, "cm:name:cars.PDF"); - restClient.assertStatusCodeIs(HttpStatus.OK); - response6.assertThat().entriesListIsNotEmpty(); - } - - @Test(priority=8) - public void testSearchDocxFile() - { - SearchRequest searchReq = new SearchRequest(); - RestRequestQueryModel queryReq = new RestRequestQueryModel(); - queryReq.setQuery("cm:name:alfresco.docx"); - queryReq.setUserQuery("alfresco.docx"); - searchReq.setQuery(queryReq); - SearchResponse response6 = queryAsUser(testUser, "cm:name:alfresco.docx"); - restClient.assertStatusCodeIs(HttpStatus.OK); - response6.assertThat().entriesListIsNotEmpty(); - } - - @Test(priority=9) - public void testSearchODTFile() - { - SearchRequest searchReq = new SearchRequest(); - RestRequestQueryModel queryReq = new RestRequestQueryModel(); - queryReq.setQuery("cm:name:unique.ODT"); - queryReq.setUserQuery("unique.ODT"); - searchReq.setQuery(queryReq); - SearchResponse response6 = queryAsUser(testUser, "cm:name:unique.ODT"); - restClient.assertStatusCodeIs(HttpStatus.OK); - response6.assertThat().entriesListIsNotEmpty(); + //TODO remove this + throw new IllegalArgumentException("Temporary exception to prove test is run"); } /** @@ -236,101 +133,4 @@ public class SearchCasesTest extends AbstractSearchServicesE2ETest bucket1.assertThat().field("filterQuery").is("modifier:\"" + testUser.getUsername() + "\""); bucket1.assertThat().field("count").is(1); } - - @Test(priority=12) - public void testSearchPhraseQueries() - { - SearchRequest searchReq = new SearchRequest(); - RestRequestQueryModel queryReq = new RestRequestQueryModel(); - queryReq.setQuery("cm:name:alfresco"); - queryReq.setUserQuery("alfresco"); - searchReq.setQuery(queryReq); - SearchResponse response6 = queryAsUser(testUser, "The quick brown fox jumps over the lazy dog"); - restClient.assertStatusCodeIs(HttpStatus.OK); - response6.assertThat().entriesListIsNotEmpty(); - } - - @Test(priority=13) - public void testSearchExactTermQueries() - { - SearchRequest searchReq = new SearchRequest(); - RestRequestQueryModel queryReq = new RestRequestQueryModel(); - queryReq.setQuery("cm:name:alfresco"); - queryReq.setUserQuery("alfresco"); - searchReq.setQuery(queryReq); - SearchResponse response6 = queryAsUser(testUser, "=alfresco"); - restClient.assertStatusCodeIs(HttpStatus.OK); - response6.assertThat().entriesListIsNotEmpty(); - } - - @Test(priority=14) - public void testSearchConjunctionQueries() - { - SearchRequest searchReq = new SearchRequest(); - RestRequestQueryModel queryReq = new RestRequestQueryModel(); - queryReq.setQuery("cm:name:unique"); - queryReq.setUserQuery("unique"); - searchReq.setQuery(queryReq); - SearchResponse response6 = queryAsUser(testUser, "unique AND search"); - restClient.assertStatusCodeIs(HttpStatus.OK); - response6.assertThat().entriesListIsNotEmpty(); - } - - @Test(priority=15) - public void testSearchDisjunctionQueries() - { - SearchRequest searchReq = new SearchRequest(); - RestRequestQueryModel queryReq = new RestRequestQueryModel(); - queryReq.setQuery("cm:name:cars"); - queryReq.setUserQuery("cars"); - searchReq.setQuery(queryReq); - SearchResponse response6 = queryAsUser(testUser, "file OR discovery"); - restClient.assertStatusCodeIs(HttpStatus.OK); - response6.assertThat().entriesListIsNotEmpty(); - } - - @Test(priority=16) - public void testSearchNegationQueries() - { - SearchRequest searchReq = new SearchRequest(); - RestRequestQueryModel queryReq = new RestRequestQueryModel(); - queryReq.setQuery("cm:name:pangram"); - queryReq.setUserQuery("pangram"); - searchReq.setQuery(queryReq); - SearchResponse response6 = queryAsUser(testUser, "pangram NOT pan"); - restClient.assertStatusCodeIs(HttpStatus.OK); - response6.assertThat().entriesListIsNotEmpty(); - } - - @Test(priority=17) - public void testSearchWildcardQueries() - { - SearchRequest searchReq = new SearchRequest(); - RestRequestQueryModel queryReq = new RestRequestQueryModel(); - queryReq.setQuery("cm:name:alfresco"); - queryReq.setUserQuery("alfresco"); - searchReq.setQuery(queryReq); - SearchResponse response6 = queryAsUser(testUser, "al?res*"); - restClient.assertStatusCodeIs(HttpStatus.OK); - response6.assertThat().entriesListIsNotEmpty(); - } - - @Test(priority=18) - public void searchSpecialCharacters() - { - String specialCharfileName = "è¥äæ§ç§-åæ.pdf"; - FileModel file = new FileModel(specialCharfileName, "è¥äæ§ç§-忬¯¸" + "è¥äæ§ç§-忬¯¸", "è¥äæ§ç§-忬¯¸", FileType.TEXT_PLAIN, - "Text file with Special Characters: " + specialCharfileName); - dataContent.usingUser(testUser).usingSite(testSite).createContent(file); - - waitForIndexing(file.getName(), true); - - SearchRequest searchReq = createQuery("name:'" + specialCharfileName + "'"); - SearchResponse nodes = query(searchReq); - - restClient.assertStatusCodeIs(HttpStatus.OK); - nodes.assertThat().entriesListIsNotEmpty(); - - restClient.onResponse().assertThat().body("list.entries.entry[0].name", Matchers.equalToIgnoringCase(specialCharfileName)); - } } diff --git a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchSimpleCasesTest.java b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchSimpleCasesTest.java new file mode 100644 index 000000000..1db77d8a4 --- /dev/null +++ b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchSimpleCasesTest.java @@ -0,0 +1,246 @@ +/* + * #%L + * Alfresco Search Services E2E Test + * %% + * Copyright (C) 2005 - 2022 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ +package org.alfresco.test.search.functional.searchServices.search; + +import org.alfresco.rest.search.RestRequestQueryModel; +import org.alfresco.rest.search.SearchRequest; +import org.alfresco.rest.search.SearchResponse; +import org.alfresco.utility.model.FileModel; +import org.alfresco.utility.model.FileType; +import org.hamcrest.Matchers; +import org.springframework.http.HttpStatus; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +public class SearchSimpleCasesTest extends AbstractSearchServicesE2ETest +{ + @BeforeClass(alwaysRun = true) + public void dataPreparation() throws Exception + { + searchServicesDataPreparation(); + waitForContentIndexing(file4.getContent(), true); + } + + @Test(priority=1) + public void testSearchNameField() + { + SearchRequest searchReq = new SearchRequest(); + RestRequestQueryModel queryReq = new RestRequestQueryModel(); + queryReq.setQuery("cm:name:pangram"); + queryReq.setUserQuery("pangram"); + searchReq.setQuery(queryReq); + SearchResponse response = queryAsUser(testUser, "cm:name:pangram"); + restClient.assertStatusCodeIs(HttpStatus.OK); + response.assertThat().entriesListIsNotEmpty(); + //TODO remove this + throw new IllegalArgumentException("Temporary exception to prove test is run"); + } + + @Test(priority=2) + public void testSearchTitleField() + { + SearchRequest searchReq = new SearchRequest(); + RestRequestQueryModel queryReq = new RestRequestQueryModel(); + queryReq.setQuery("cm:title:cars"); + queryReq.setUserQuery("cars"); + searchReq.setQuery(queryReq); + SearchResponse response2 = queryAsUser(testUser, "cm:title:cars"); + restClient.assertStatusCodeIs(HttpStatus.OK); + response2.assertThat().entriesListIsNotEmpty(); + } + + @Test(priority=3) + public void testSearchDescriptionField() + { + SearchRequest searchReq = new SearchRequest(); + RestRequestQueryModel queryReq = new RestRequestQueryModel(); + queryReq.setQuery("cm:description:alfresco"); + queryReq.setUserQuery("alfresco"); + searchReq.setQuery(queryReq); + SearchResponse response3 = queryAsUser(testUser, "cm:description:alfresco"); + restClient.assertStatusCodeIs(HttpStatus.OK); + response3.assertThat().entriesListIsNotEmpty(); + } + + @Test(priority=4) + public void testSearchContentField() + { + SearchRequest searchReq = new SearchRequest(); + RestRequestQueryModel queryReq = new RestRequestQueryModel(); + queryReq.setQuery("cm:content:unique"); + queryReq.setUserQuery("unique"); + searchReq.setQuery(queryReq); + SearchResponse response4 = queryAsUser(testUser, "cm:content:unique"); + restClient.assertStatusCodeIs(HttpStatus.OK); + response4.assertThat().entriesListIsNotEmpty(); + } + + @Test(priority=6) + public void testSearchTextFile() + { + SearchRequest searchReq = new SearchRequest(); + RestRequestQueryModel queryReq = new RestRequestQueryModel(); + queryReq.setQuery("cm:name:pangram.txt"); + queryReq.setUserQuery("pangram.txt"); + searchReq.setQuery(queryReq); + SearchResponse response6 = queryAsUser(testUser, "cm:name:pangram.txt"); + restClient.assertStatusCodeIs(HttpStatus.OK); + response6.assertThat().entriesListIsNotEmpty(); + } + + @Test(priority=7) + public void testSearchPDFFile() + { + SearchRequest searchReq = new SearchRequest(); + RestRequestQueryModel queryReq = new RestRequestQueryModel(); + queryReq.setQuery("cm:name:cars.PDF"); + queryReq.setUserQuery("cars.PDF"); + searchReq.setQuery(queryReq); + SearchResponse response6 = queryAsUser(testUser, "cm:name:cars.PDF"); + restClient.assertStatusCodeIs(HttpStatus.OK); + response6.assertThat().entriesListIsNotEmpty(); + } + + @Test(priority=8) + public void testSearchDocxFile() + { + SearchRequest searchReq = new SearchRequest(); + RestRequestQueryModel queryReq = new RestRequestQueryModel(); + queryReq.setQuery("cm:name:alfresco.docx"); + queryReq.setUserQuery("alfresco.docx"); + searchReq.setQuery(queryReq); + SearchResponse response6 = queryAsUser(testUser, "cm:name:alfresco.docx"); + restClient.assertStatusCodeIs(HttpStatus.OK); + response6.assertThat().entriesListIsNotEmpty(); + } + + @Test(priority=9) + public void testSearchODTFile() + { + SearchRequest searchReq = new SearchRequest(); + RestRequestQueryModel queryReq = new RestRequestQueryModel(); + queryReq.setQuery("cm:name:unique.ODT"); + queryReq.setUserQuery("unique.ODT"); + searchReq.setQuery(queryReq); + SearchResponse response6 = queryAsUser(testUser, "cm:name:unique.ODT"); + restClient.assertStatusCodeIs(HttpStatus.OK); + response6.assertThat().entriesListIsNotEmpty(); + } + + @Test(priority=12) + public void testSearchPhraseQueries() + { + SearchRequest searchReq = new SearchRequest(); + RestRequestQueryModel queryReq = new RestRequestQueryModel(); + queryReq.setQuery("cm:name:alfresco"); + queryReq.setUserQuery("alfresco"); + searchReq.setQuery(queryReq); + SearchResponse response6 = queryAsUser(testUser, "The quick brown fox jumps over the lazy dog"); + restClient.assertStatusCodeIs(HttpStatus.OK); + response6.assertThat().entriesListIsNotEmpty(); + } + + @Test(priority=13) + public void testSearchExactTermQueries() + { + SearchRequest searchReq = new SearchRequest(); + RestRequestQueryModel queryReq = new RestRequestQueryModel(); + queryReq.setQuery("cm:name:alfresco"); + queryReq.setUserQuery("alfresco"); + searchReq.setQuery(queryReq); + SearchResponse response6 = queryAsUser(testUser, "=alfresco"); + restClient.assertStatusCodeIs(HttpStatus.OK); + response6.assertThat().entriesListIsNotEmpty(); + } + + @Test(priority=14) + public void testSearchConjunctionQueries() + { + SearchRequest searchReq = new SearchRequest(); + RestRequestQueryModel queryReq = new RestRequestQueryModel(); + queryReq.setQuery("cm:name:unique"); + queryReq.setUserQuery("unique"); + searchReq.setQuery(queryReq); + SearchResponse response6 = queryAsUser(testUser, "unique AND search"); + restClient.assertStatusCodeIs(HttpStatus.OK); + response6.assertThat().entriesListIsNotEmpty(); + } + + @Test(priority=15) + public void testSearchDisjunctionQueries() + { + SearchRequest searchReq = new SearchRequest(); + RestRequestQueryModel queryReq = new RestRequestQueryModel(); + queryReq.setQuery("cm:name:cars"); + queryReq.setUserQuery("cars"); + searchReq.setQuery(queryReq); + SearchResponse response6 = queryAsUser(testUser, "file OR discovery"); + restClient.assertStatusCodeIs(HttpStatus.OK); + response6.assertThat().entriesListIsNotEmpty(); + } + + @Test(priority=16) + public void testSearchNegationQueries() + { + SearchRequest searchReq = new SearchRequest(); + RestRequestQueryModel queryReq = new RestRequestQueryModel(); + queryReq.setQuery("cm:name:pangram"); + queryReq.setUserQuery("pangram"); + searchReq.setQuery(queryReq); + SearchResponse response6 = queryAsUser(testUser, "pangram NOT pan"); + restClient.assertStatusCodeIs(HttpStatus.OK); + response6.assertThat().entriesListIsNotEmpty(); + } + + @Test(priority=17) + public void testSearchWildcardQueries() + { + SearchRequest searchReq = new SearchRequest(); + RestRequestQueryModel queryReq = new RestRequestQueryModel(); + queryReq.setQuery("cm:name:alfresco"); + queryReq.setUserQuery("alfresco"); + searchReq.setQuery(queryReq); + SearchResponse response6 = queryAsUser(testUser, "al?res*"); + restClient.assertStatusCodeIs(HttpStatus.OK); + response6.assertThat().entriesListIsNotEmpty(); + } + + @Test(priority=18) + public void searchSpecialCharacters() + { + String specialCharfileName = "è¥äæ§ç§-åæ.pdf"; + FileModel file = new FileModel(specialCharfileName, "è¥äæ§ç§-忬¯¸" + "è¥äæ§ç§-忬¯¸", "è¥äæ§ç§-忬¯¸", FileType.TEXT_PLAIN, + "Text file with Special Characters: " + specialCharfileName); + dataContent.usingUser(testUser).usingSite(testSite).createContent(file); + + waitForIndexing(file.getName(), true); + + SearchRequest searchReq = createQuery("name:'" + specialCharfileName + "'"); + SearchResponse nodes = query(searchReq); + + restClient.assertStatusCodeIs(HttpStatus.OK); + nodes.assertThat().entriesListIsNotEmpty(); + + restClient.onResponse().assertThat().body("list.entries.entry[0].name", Matchers.equalToIgnoringCase(specialCharfileName)); + } +} diff --git a/e2e-test/src/test/resources/PipelineSuite.xml b/e2e-test/src/test/resources/PipelineSuite.xml index 8716f6015..e37ce4a27 100644 --- a/e2e-test/src/test/resources/PipelineSuite.xml +++ b/e2e-test/src/test/resources/PipelineSuite.xml @@ -9,7 +9,7 @@ - + From 656b6bf9b7a2ab46719b84122964806454bfbf7d Mon Sep 17 00:00:00 2001 From: Sara Aspery Date: Tue, 20 Dec 2022 00:20:26 +0000 Subject: [PATCH 27/27] Removal of temporary exceptions to verify tests are run --- .../functional/searchServices/search/SearchCasesTest.java | 3 --- .../searchServices/search/SearchSimpleCasesTest.java | 2 -- 2 files changed, 5 deletions(-) diff --git a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java index e7bc5d796..9caae205a 100644 --- a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java +++ b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchCasesTest.java @@ -81,9 +81,6 @@ public class SearchCasesTest extends AbstractSearchServicesE2ETest SearchResponse response4 = queryAsUser(testUser, "cm:content:" + newText); restClient.assertStatusCodeIs(HttpStatus.OK); Assert.assertEquals(response4.getEntries().size(), 1, "Expected 1 new text before update"); - - //TODO remove this - throw new IllegalArgumentException("Temporary exception to prove test is run"); } /** diff --git a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchSimpleCasesTest.java b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchSimpleCasesTest.java index 1db77d8a4..ccd2415c9 100644 --- a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchSimpleCasesTest.java +++ b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchSimpleCasesTest.java @@ -52,8 +52,6 @@ public class SearchSimpleCasesTest extends AbstractSearchServicesE2ETest SearchResponse response = queryAsUser(testUser, "cm:name:pangram"); restClient.assertStatusCodeIs(HttpStatus.OK); response.assertThat().entriesListIsNotEmpty(); - //TODO remove this - throw new IllegalArgumentException("Temporary exception to prove test is run"); } @Test(priority=2)