Merge branch 'feature/5.2.N-AUDIT-API' into 'REPO-2582'

# Conflicts:
#   src/main/java/org/alfresco/rest/requests/coreAPI/RestCoreAPI.java
This commit is contained in:
Alexandru Epure
2017-07-04 11:35:13 +01:00
3 changed files with 41 additions and 32 deletions
@@ -41,8 +41,9 @@ import org.testng.annotations.Test;
public class PivotFacetedSearchTest extends AbstractSearchTest
{
@Test(groups = { TestGroup.REST_API, TestGroup.SEARCH })
@TestRail(section = {TestGroup.REST_API, TestGroup.SEARCH }, executionType = ExecutionType.REGRESSION,
@Test(groups = { TestGroup.REST_API, TestGroup.SEARCH, TestGroup.ASS_1 })
@TestRail(section = {TestGroup.REST_API, TestGroup.SEARCH, TestGroup.ASS_1 },
executionType = ExecutionType.REGRESSION,
description = "Checks errors with pivot using Search api")
public void searchWithPivotingErrors() throws Exception
{
@@ -70,8 +71,9 @@ public class PivotFacetedSearchTest extends AbstractSearchTest
.containsSummary("Pivot parameter none_like_this does not reference");
}
@Test(groups = { TestGroup.REST_API, TestGroup.SEARCH })
@TestRail(section = {TestGroup.REST_API, TestGroup.SEARCH }, executionType = ExecutionType.REGRESSION,
@Test(groups = { TestGroup.REST_API, TestGroup.SEARCH, TestGroup.ASS_1 })
@TestRail(section = {TestGroup.REST_API, TestGroup.SEARCH, TestGroup.ASS_1 },
executionType = ExecutionType.REGRESSION,
description = "Checks with pivot using Search api")
public void searchWithPivoting() throws Exception
{
@@ -98,8 +100,9 @@ public class PivotFacetedSearchTest extends AbstractSearchTest
assertPivotResponse(response, "creator", null);
}
@Test(groups = { TestGroup.REST_API, TestGroup.SEARCH })
@TestRail(section = {TestGroup.REST_API, TestGroup.SEARCH }, executionType = ExecutionType.REGRESSION,
@Test(groups = { TestGroup.REST_API, TestGroup.SEARCH, TestGroup.ASS_1 })
@TestRail(section = {TestGroup.REST_API, TestGroup.SEARCH, TestGroup.ASS_1 },
executionType = ExecutionType.REGRESSION,
description = "Checks nested pivot using Search api")
public void searchWithNestedPivoting() throws Exception
{
@@ -154,8 +157,9 @@ public class PivotFacetedSearchTest extends AbstractSearchTest
creatorResponse.assertThat().field("label").is("creator");
}
@Test(groups = { TestGroup.REST_API, TestGroup.SEARCH })
@TestRail(section = {TestGroup.REST_API, TestGroup.SEARCH }, executionType = ExecutionType.REGRESSION,
@Test(groups = { TestGroup.REST_API, TestGroup.SEARCH, TestGroup.ASS_1 })
@TestRail(section = {TestGroup.REST_API, TestGroup.SEARCH, TestGroup.ASS_1 },
executionType = ExecutionType.REGRESSION,
description = "Checks range pivots using Search api")
public void searchWithRangePivoting() throws Exception
{
@@ -216,8 +220,9 @@ public class PivotFacetedSearchTest extends AbstractSearchTest
Assert.assertTrue(bucket.getMetrics().get(0).getValue().toString().contains("{count="));
}
@Test(groups = { TestGroup.REST_API, TestGroup.SEARCH })
@TestRail(section = {TestGroup.REST_API, TestGroup.SEARCH }, executionType = ExecutionType.REGRESSION,
@Test(groups = { TestGroup.REST_API, TestGroup.SEARCH, TestGroup.ASS_1 })
@TestRail(section = {TestGroup.REST_API, TestGroup.SEARCH, TestGroup.ASS_1 },
executionType = ExecutionType.REGRESSION,
description = "Checks with pivot using Search api and a label as a key")
public void searchWithPivotingUsingLabel() throws Exception
{
@@ -26,7 +26,6 @@ import org.alfresco.utility.model.TestGroup;
import org.alfresco.utility.testrail.ExecutionType;
import org.alfresco.utility.testrail.annotation.TestRail;
import org.springframework.http.HttpStatus;
import org.testng.Assert;
import org.testng.annotations.Test;
import java.util.ArrayList;
@@ -44,8 +43,9 @@ import java.util.stream.Collectors;
public class StatsSearchTest extends AbstractSearchTest
{
@Test(groups = { TestGroup.REST_API, TestGroup.SEARCH })
@TestRail(section = {TestGroup.REST_API, TestGroup.SEARCH }, executionType = ExecutionType.REGRESSION,
@Test(groups = { TestGroup.REST_API, TestGroup.SEARCH, TestGroup.ASS_1 })
@TestRail(section = {TestGroup.REST_API, TestGroup.SEARCH, TestGroup.ASS_1 },
executionType = ExecutionType.REGRESSION,
description = "Checks errors with stats using Search api")
public void searchWithBasicStats() throws Exception
{
@@ -66,19 +66,19 @@ public class StatsSearchTest extends AbstractSearchTest
response = query(query);
//8 metrics by default for a numeric field
Set<String> metricTypes = assertStatsFacetedResponse(response, "DBID", 8);
assertTrue(metricTypes.containsAll(Arrays.asList("missing", "count", "sum","min","max", "sumOfSquares", "mean", "stddev")));
assertTrue(metricTypes.containsAll(Arrays.asList("missing", "countValues", "sum","min","max", "sumOfSquares", "mean", "stddev")));
statsModel1.setField("creator");
response = query(query);
//4 metrics by default for a string field
metricTypes = assertStatsFacetedResponse(response, "creator", 4);
assertTrue(metricTypes.containsAll(Arrays.asList("missing", "count", "min","max")));
assertTrue(metricTypes.containsAll(Arrays.asList("missing", "countValues", "min","max")));
statsModel1.setField("modified");
response = query(query);
//8 metrics by default for a date field
metricTypes = assertStatsFacetedResponse(response, "modified", 8);
assertTrue(metricTypes.containsAll(Arrays.asList("missing", "count", "sum","min","max", "sumOfSquares", "mean", "stddev")));
assertTrue(metricTypes.containsAll(Arrays.asList("missing", "countValues", "sum","min","max", "sumOfSquares", "mean", "stddev")));
statsModel1.setField("modifier");
statsModel1.setMin(false);
@@ -91,7 +91,7 @@ public class StatsSearchTest extends AbstractSearchTest
statsModel1.setField("DBID");
statsModel1.setMin(true);
statsModel1.setMax(true);
statsModel1.setCount(false);
statsModel1.setCountValues(false);
statsModel1.setMissing(false);
statsModel1.setSum(false);
statsModel1.setSumOfSquares(false);
@@ -100,7 +100,7 @@ public class StatsSearchTest extends AbstractSearchTest
response = query(query);
metricTypes = assertStatsFacetedResponse(response, "DBID", 2);
assertTrue(metricTypes.containsAll(Arrays.asList("min","max")));
assertFalse(metricTypes.containsAll(Arrays.asList("missing", "count", "sum","sumOfSquares", "mean", "stddev")));
assertFalse(metricTypes.containsAll(Arrays.asList("missing", "countValues", "sum","sumOfSquares", "mean", "stddev")));
statsModel1.setField("modifier");
statsModel1.setMin(false);
@@ -127,8 +127,9 @@ public class StatsSearchTest extends AbstractSearchTest
assertTrue(percentiles.keySet().containsAll(Arrays.asList("1.0","75.0","99.0","99.9")));
}
@Test(groups = { TestGroup.REST_API, TestGroup.SEARCH })
@TestRail(section = {TestGroup.REST_API, TestGroup.SEARCH }, executionType = ExecutionType.REGRESSION,
@Test(groups = { TestGroup.REST_API, TestGroup.SEARCH, TestGroup.ASS_1 })
@TestRail(section = {TestGroup.REST_API, TestGroup.SEARCH, TestGroup.ASS_1 },
executionType = ExecutionType.REGRESSION,
description = "Checks errors with stats labels using Search api")
public void searchWithStatsLabel() throws Exception
{
@@ -146,8 +147,9 @@ public class StatsSearchTest extends AbstractSearchTest
assertStatsFacetedResponse(response, "DateChanged", 8);
}
@Test(groups = { TestGroup.REST_API, TestGroup.SEARCH })
@TestRail(section = {TestGroup.REST_API, TestGroup.SEARCH }, executionType = ExecutionType.REGRESSION,
@Test(groups = { TestGroup.REST_API, TestGroup.SEARCH, TestGroup.ASS_1 })
@TestRail(section = {TestGroup.REST_API, TestGroup.SEARCH, TestGroup.ASS_1 },
executionType = ExecutionType.REGRESSION,
description = "Checks errors with stats fitlers using Search api")
public void searchWithStatsFilters() throws Exception
{
@@ -169,7 +171,7 @@ public class StatsSearchTest extends AbstractSearchTest
RestGenericMetricModel countMetric = response.getContext().getFacets().get(0).getBuckets().get(0).getMetrics().get(0);
Integer count = response.getPagination().getTotalItems();
Map metricCount = (Map) countMetric.getValue();
assertEquals(count, metricCount.get("count"));
assertEquals(count, metricCount.get("countValues"));
statsModel1.setExcludeFilters(Arrays.asList("justCars"));
response = query(query);
@@ -177,11 +179,12 @@ public class StatsSearchTest extends AbstractSearchTest
countMetric = response.getContext().getFacets().get(0).getBuckets().get(0).getMetrics().get(0);
count = response.getEntries().size();
metricCount = (Map) countMetric.getValue();
assertTrue((Integer)metricCount.get("count") > count, "With the exclude filter there will be more documents than returned");
assertTrue((Integer)metricCount.get("countValues") > count, "With the exclude filter there will be more documents than returned");
}
@Test(groups = { TestGroup.REST_API, TestGroup.SEARCH })
@TestRail(section = {TestGroup.REST_API, TestGroup.SEARCH }, executionType = ExecutionType.REGRESSION,
@Test(groups = { TestGroup.REST_API, TestGroup.SEARCH, TestGroup.ASS_1 })
@TestRail(section = {TestGroup.REST_API, TestGroup.SEARCH, TestGroup.ASS_1 },
executionType = ExecutionType.REGRESSION,
description = "Checks errors with stats with Pivot using Search api")
public void searchWithStatsAndMutlilevelPivot() throws Exception
{
@@ -238,13 +241,14 @@ public class StatsSearchTest extends AbstractSearchTest
created.assertThat().field("type").is("pivot");
created.assertThat().field("label").is("created");
//Another nested stats
assertEquals(created.getBuckets().get(0).getMetrics().size(), 8, "Metrics are on the end of a pivot bucket");
assertEquals(created.getBuckets().get(0).getMetrics().size(), 9, "Metrics are on the end of a pivot bucket");
}
@Test(groups = { TestGroup.REST_API, TestGroup.SEARCH })
@TestRail(section = {TestGroup.REST_API, TestGroup.SEARCH }, executionType = ExecutionType.REGRESSION,
@Test(groups = { TestGroup.REST_API, TestGroup.SEARCH, TestGroup.ASS_1 })
@TestRail(section = {TestGroup.REST_API, TestGroup.SEARCH, TestGroup.ASS_1 },
executionType = ExecutionType.REGRESSION,
description = "Checks errors with stats with Pivot using Search api")
public void searchWithStatsAndPivot() throws Exception
{
@@ -287,7 +291,7 @@ public class StatsSearchTest extends AbstractSearchTest
RestGenericFacetResponseModel facetResponseModel = response.getContext().getFacets().get(0);
facetResponseModel.assertThat().field("type").is("pivot");
facetResponseModel.assertThat().field("label").is("creator");
assertEquals(facetResponseModel.getBuckets().get(0).getMetrics().size(), 8, "Metrics are on the end of a pivot bucket");
assertEquals(facetResponseModel.getBuckets().get(0).getMetrics().size(), 9, "Metrics are on the end of a pivot bucket");
RestGenericFacetResponseModel statsFacet = response.getContext().getFacets().get(1);
statsFacet.assertThat().field("type").is("stats");
statsFacet.assertThat().field("label").is("numericId");
@@ -60,7 +60,7 @@ public class GetDeletedNodesTests extends RestTest
public void testDeletedNodesBiggerThanMaxCount() throws Exception
{
//get the number of item in the trashcan
RestNodeModelsCollection deletedNodes = restClient.withCoreAPI().usingQueries().findDeletedNodes();
RestNodeModelsCollection deletedNodes = restClient.withCoreAPI().usingTrashcan().findDeletedNodes();
int count = deletedNodes.getPagination().getCount();
int totalItems = deletedNodes.getPagination().getTotalItems();
@@ -75,7 +75,7 @@ public class GetDeletedNodesTests extends RestTest
dataContent.usingUser(adminUserModel).usingResource(deleteNodesFolder3).deleteContent();
int maxItems = count + 1;
RestNodeModelsCollection deletedNodesMaxItem = restClient.withCoreAPI().usingQueries().usingParams(String.format("maxItems=%s", maxItems)).findDeletedNodes();
RestNodeModelsCollection deletedNodesMaxItem = restClient.withCoreAPI().usingTrashcan().usingParams(String.format("maxItems=%s", maxItems)).findDeletedNodes();
String countMaxItem = Integer.toString(maxItems);
String totalItemsMaxItem = Integer.toString(totalItems + 3);