mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
[REPO-5552] TAS aspect/type api (#319)
* [REPO-5552] TAS initial commit * [REPO-5552] * model added * [REPO-5552] * revert comments * [REPO-5552] * minor conventions fixes * [REPO-5552] * minor update
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
package org.alfresco.rest.models.aspects;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestAspectModel;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
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.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class GetAspectTests extends RestTest
|
||||
{
|
||||
|
||||
@BeforeClass(alwaysRun=true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(dataUser.createRandomTestUser());
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.MODEL, TestGroup.REGRESSION })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.MODEL }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify inexistent aspect and status code is Not Found (404)")
|
||||
public void getInexistentAspect() throws Exception
|
||||
{
|
||||
String unknownAspect = "unknown:aspect";
|
||||
restClient.withModelAPI().getAspect(unknownAspect);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_WAS_NOT_FOUND, unknownAspect));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.MODEL, TestGroup.REGRESSION })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.MODEL }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify Aspect Info and status code is OK (200)")
|
||||
public void getAspect() throws Exception
|
||||
{
|
||||
RestAspectModel aspect = restClient.withModelAPI().getAspect("cm:titled");
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
aspect.assertThat().field("associations").isEmpty().and()
|
||||
.field("mandatoryAspects").isEmpty().and()
|
||||
.field("properties").isNotEmpty().and()
|
||||
.field("includedInSupertypeQuery").is(true).and()
|
||||
.field("isContainer").is(false).and()
|
||||
.field("id").is("cm:titled").and()
|
||||
.field("description").is("Titled").and()
|
||||
.field("title").is("Titled").and()
|
||||
.field("model.id").is("cm:contentmodel").and()
|
||||
.field("model.author").is("Alfresco").and()
|
||||
.field("model.description").is("Alfresco Content Domain Model").and()
|
||||
.field("model.namespaceUri").is("http://www.alfresco.org/model/content/1.0").and()
|
||||
.field("model.namespacePrefix").is("cm");
|
||||
}
|
||||
}
|
@@ -0,0 +1,199 @@
|
||||
package org.alfresco.rest.models.aspects;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestAbstractClassModel;
|
||||
import org.alfresco.rest.model.RestAspectsCollection;
|
||||
import org.alfresco.utility.model.TestGroup;
|
||||
import org.alfresco.utility.model.UserModel;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class GetAspectsTests extends RestTest
|
||||
{
|
||||
|
||||
private UserModel regularUser;
|
||||
|
||||
@BeforeClass(alwaysRun=true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
regularUser = dataUser.createRandomTestUser();
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.MODEL, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.MODEL }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user get aspects and gets status code OK (200)")
|
||||
public void getAspects() throws Exception
|
||||
{
|
||||
RestAspectsCollection aspects = restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.getAspects();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
aspects.assertThat()
|
||||
.entriesListCountIs(100)
|
||||
.and().entriesListContains("id", "cm:classifiable")
|
||||
.and().entriesListContains("id", "cm:author")
|
||||
.and().entriesListContains("id", "cm:checkedOut");
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.MODEL, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.MODEL }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Should filter aspects using namespace uri and gets status code OK (200)")
|
||||
public void getAspectByNamespaceUri() throws Exception
|
||||
{
|
||||
RestAspectsCollection aspects = restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("where=(namespaceUri matches('http://www.alfresco.org/model.*'))")
|
||||
.getAspects();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
aspects.assertThat().entriesListCountIs(100);
|
||||
|
||||
aspects = restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("where=(not namespaceUri matches('http://www.alfresco.org/model.*'))")
|
||||
.getAspects();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
aspects.assertThat().entriesListCountIs(0);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.MODEL, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.MODEL }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Should filter aspects using modelId and gets status code OK (200)")
|
||||
public void getAspectByModelsIds() throws Exception
|
||||
{
|
||||
RestAspectsCollection aspects = restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("where=(modelId in ('cm:contentmodel', 'smf:smartFolder'))")
|
||||
.getAspects();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
aspects.getPagination().assertThat().fieldsCount().is(5).and()
|
||||
.field("totalItems").isLessThan(65).and()
|
||||
.field("maxItems").is(100).and()
|
||||
.field("skipCount").isGreaterThan(0).and()
|
||||
.field("hasMoreItems").is(false);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.MODEL, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.MODEL }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Should filter aspects using modelId with subaspects and gets status code OK (200)")
|
||||
public void getAspectByModelsIdsWithIncludeSubAspects() throws Exception
|
||||
{
|
||||
RestAspectsCollection aspects = restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("where=(modelId in ('cm:contentmodel INCLUDESUBASPECTS', 'smf:smartFolder INCLUDESUBASPECTS'))")
|
||||
.getAspects();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
aspects.getPagination().assertThat().fieldsCount().is(5).and()
|
||||
.field("totalItems").isGreaterThan(65).and()
|
||||
.field("maxItems").is(100).and()
|
||||
.field("skipCount").isGreaterThan(0).and()
|
||||
.field("hasMoreItems").is(false);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.MODEL, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.MODEL }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Should filter aspects using parentId and gets status code OK (200)")
|
||||
public void getAspectByParentId() throws Exception
|
||||
{
|
||||
RestAspectsCollection aspects = restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("where=(parentId in ('cm:titled'))")
|
||||
.getAspects();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
aspects.getPagination().assertThat().fieldsCount().is(5).and()
|
||||
.field("totalItems").is(5).and()
|
||||
.field("hasMoreItems").is(false);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.MODEL, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.MODEL }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Should Aspects association, properties and mandatory aspects and gets status code OK (200)")
|
||||
public void getAspectIncludeParams() throws Exception
|
||||
{
|
||||
RestAspectsCollection aspects = restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("include=properties,mandatoryAspects,associations")
|
||||
.getAspects();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
|
||||
for (RestAbstractClassModel aspect : aspects.getEntries())
|
||||
{
|
||||
aspect.onModel().assertThat()
|
||||
.field("associations").isNotNull().and()
|
||||
.field("properties").isNotNull().and()
|
||||
.field("mandatoryAspects").isNotNull();
|
||||
}
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.MODEL, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.MODEL }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Should verify the query errors with possible options")
|
||||
public void verifyAspectsQueryError()
|
||||
{
|
||||
restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("where=(modelId in (' ')")
|
||||
.getAspects();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
|
||||
|
||||
restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("where=(modelId in ('cm:contentmodel INCLUDESUBASPECTS',))")
|
||||
.getAspects();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
|
||||
|
||||
restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("where=(modelId in ('cm:contentmodel INCLUDESUBTYPES'))")
|
||||
.getAspects();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
|
||||
|
||||
restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("where=(parentId in (' ')")
|
||||
.getAspects();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
|
||||
|
||||
restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("where=(parentId in ('cm:content',))")
|
||||
.getAspects();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
|
||||
|
||||
restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("where=(parentId in ('cm:content',))&include=properties")
|
||||
.getAspects();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
|
||||
|
||||
restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("where=(namespaceUri matches('*'))")
|
||||
.getAspects();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
|
||||
|
||||
restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("where=(parentId in ('cm:content'))&include=properties")
|
||||
.getAspects();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.MODEL, TestGroup.REGRESSION })
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.MODEL}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify if any user gets aspects with high skipCount and maxItems parameter applied")
|
||||
public void getPaginationParameter() throws Exception
|
||||
{
|
||||
RestAspectsCollection aspects = restClient.authenticateUser(regularUser)
|
||||
.withModelAPI()
|
||||
.usingParams("maxItems=10&skipCount=10")
|
||||
.getAspects();
|
||||
aspects.assertThat().entriesListCountIs(10);
|
||||
aspects.assertThat().paginationField("hasMoreItems").is("true");
|
||||
aspects.assertThat().paginationField("skipCount").is("10");
|
||||
aspects.assertThat().paginationField("maxItems").is("10");
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.MODEL, TestGroup.REGRESSION })
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.MODEL}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify if any user gets aspects with hasMoreItems applied bases on skip count and maxItems")
|
||||
public void getHighPaginationQuery() throws Exception
|
||||
{
|
||||
RestAspectsCollection aspects = restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("maxItems=10&skipCount=150")
|
||||
.getAspects();
|
||||
aspects.assertThat().entriesListCountIs(0);
|
||||
aspects.assertThat().paginationField("hasMoreItems").is("false");
|
||||
aspects.assertThat().paginationField("skipCount").is("150");
|
||||
aspects.assertThat().paginationField("maxItems").is("10");
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
}
|
@@ -0,0 +1,55 @@
|
||||
package org.alfresco.rest.models.types;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestTypeModel;
|
||||
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.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class GetTypeTests extends RestTest
|
||||
{
|
||||
|
||||
@BeforeClass(alwaysRun=true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(dataUser.createRandomTestUser());
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.MODEL, TestGroup.REGRESSION })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.MODEL }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify inexistent type and status code is Not Found (404)")
|
||||
public void getInexistentType() throws Exception
|
||||
{
|
||||
String unknownType = "unknown:type";
|
||||
restClient.withModelAPI().getType(unknownType);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_WAS_NOT_FOUND, unknownType));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.MODEL, TestGroup.REGRESSION })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.MODEL }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify Type Info and status code is OK (200)")
|
||||
public void getType() throws Exception
|
||||
{
|
||||
RestTypeModel type = restClient.withModelAPI().getType("cm:content");
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
type.assertThat().field("associations").isEmpty().and()
|
||||
.field("mandatoryAspects").isNotEmpty().and()
|
||||
.field("properties").isNotEmpty().and()
|
||||
.field("includedInSupertypeQuery").is(true).and()
|
||||
.field("isArchive").is(true).and()
|
||||
.field("isContainer").is(false).and()
|
||||
.field("id").is("cm:content").and()
|
||||
.field("description").is("Base Content Object").and()
|
||||
.field("title").is("Content").and()
|
||||
.field("model.id").is("cm:contentmodel").and()
|
||||
.field("model.author").is("Alfresco").and()
|
||||
.field("model.description").is("Alfresco Content Domain Model").and()
|
||||
.field("model.namespaceUri").is("http://www.alfresco.org/model/content/1.0").and()
|
||||
.field("model.namespacePrefix").is("cm");
|
||||
}
|
||||
}
|
@@ -0,0 +1,199 @@
|
||||
package org.alfresco.rest.models.types;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestAbstractClassModel;
|
||||
import org.alfresco.rest.model.RestTypesCollection;
|
||||
import org.alfresco.utility.model.TestGroup;
|
||||
import org.alfresco.utility.model.UserModel;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class GetTypesTests extends RestTest
|
||||
{
|
||||
|
||||
private UserModel regularUser;
|
||||
|
||||
@BeforeClass(alwaysRun=true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
regularUser = dataUser.createRandomTestUser();
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.MODEL, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.MODEL }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user get types and gets status code OK (200)")
|
||||
public void getTypes() throws Exception
|
||||
{
|
||||
RestTypesCollection types = restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.getTypes();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
types.assertThat()
|
||||
.entriesListCountIs(100)
|
||||
.and().entriesListContains("id", "cm:content")
|
||||
.and().entriesListContains("id", "cm:systemfolder")
|
||||
.and().entriesListContains("id", "cm:folder");
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.MODEL, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.MODEL }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Should filter types using namespace uri and gets status code OK (200)")
|
||||
public void getTypeByNamespaceUri() throws Exception
|
||||
{
|
||||
RestTypesCollection types = restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("where=(namespaceUri matches('http://www.alfresco.org/model.*'))")
|
||||
.getTypes();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
types.assertThat().entriesListCountIs(100);
|
||||
|
||||
types = restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("where=(not namespaceUri matches('http://www.alfresco.org/model.*'))")
|
||||
.getTypes();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
types.assertThat().entriesListCountIs(0);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.MODEL, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.MODEL }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Should filter types using modelId and gets status code OK (200)")
|
||||
public void getTypeByModelsIds() throws Exception
|
||||
{
|
||||
RestTypesCollection types = restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("where=(modelId in ('cm:contentmodel', 'smf:smartFolder'))")
|
||||
.getTypes();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
types.getPagination().assertThat().fieldsCount().is(5).and()
|
||||
.field("totalItems").isLessThan(65).and()
|
||||
.field("maxItems").is(100).and()
|
||||
.field("skipCount").isGreaterThan(0).and()
|
||||
.field("hasMoreItems").is(false);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.MODEL, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.MODEL }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Should filter types using modelId with subtypes and gets status code OK (200)")
|
||||
public void getTypeByModelsIdsWithIncludeSubTypes() throws Exception
|
||||
{
|
||||
RestTypesCollection types = restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("where=(modelId in ('cm:contentmodel INCLUDESUBTYPES', 'smf:smartFolder INCLUDESUBTYPES'))")
|
||||
.getTypes();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
types.getPagination().assertThat().fieldsCount().is(5).and()
|
||||
.field("totalItems").isGreaterThan(65).and()
|
||||
.field("maxItems").is(100).and()
|
||||
.field("skipCount").isGreaterThan(0).and()
|
||||
.field("hasMoreItems").is(false);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.MODEL, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.MODEL }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Should filter types using parentId and gets status code OK (200)")
|
||||
public void getTypeByParentId() throws Exception
|
||||
{
|
||||
RestTypesCollection types = restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("where=(parentId in ('cm:content'))")
|
||||
.getTypes();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
types.getPagination().assertThat().fieldsCount().is(5).and()
|
||||
.field("totalItems").isGreaterThan(40).and()
|
||||
.field("hasMoreItems").is(false);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.MODEL, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.MODEL }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Should get Type with association, properties and mandatory types and gets status code OK (200)")
|
||||
public void getTypeIncludeParams() throws Exception
|
||||
{
|
||||
RestTypesCollection types = restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("include=properties,mandatoryAspects,associations")
|
||||
.getTypes();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
|
||||
for (RestAbstractClassModel type : types.getEntries())
|
||||
{
|
||||
type.onModel().assertThat()
|
||||
.field("associations").isNotNull().and()
|
||||
.field("properties").isNotNull().and()
|
||||
.field("mandatoryAspects").isNotNull();
|
||||
}
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.MODEL, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.MODEL }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Should verify the query errors with possible options")
|
||||
public void verifyTypesQueryError() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("where=(modelId in (' ')")
|
||||
.getTypes();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
|
||||
|
||||
restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("where=(modelId in ('cm:contentmodel INCLUDESUBTYPES',))")
|
||||
.getTypes();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
|
||||
|
||||
restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("where=(modelId in ('cm:contentmodel INCLUDESUBASPECTS'))")
|
||||
.getTypes();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
|
||||
|
||||
restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("where=(parentId in (' ')")
|
||||
.getTypes();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
|
||||
|
||||
restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("where=(parentId in ('cm:titled',))")
|
||||
.getTypes();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
|
||||
|
||||
restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("where=(parentId in ('cm:titled',))&include=properties")
|
||||
.getTypes();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
|
||||
|
||||
restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("where=(namespaceUri matches('*'))")
|
||||
.getTypes();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
|
||||
|
||||
restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("where=(parentId in ('cm:titled'))&include=properties")
|
||||
.getTypes();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.MODEL, TestGroup.REGRESSION })
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.MODEL}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify if any user gets types with high skipCount and maxItems parameter applied")
|
||||
public void getPaginationParameter() throws Exception
|
||||
{
|
||||
RestTypesCollection types = restClient.authenticateUser(regularUser)
|
||||
.withModelAPI()
|
||||
.usingParams("maxItems=10&skipCount=10")
|
||||
.getTypes();
|
||||
types.assertThat().entriesListCountIs(10);
|
||||
types.assertThat().paginationField("hasMoreItems").is("true");
|
||||
types.assertThat().paginationField("skipCount").is("10");
|
||||
types.assertThat().paginationField("maxItems").is("10");
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.MODEL, TestGroup.REGRESSION })
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.MODEL}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify if any user gets types with hasMoreItems applied bases on skip count and maxItems")
|
||||
public void getHighPaginationQuery() throws Exception
|
||||
{
|
||||
RestTypesCollection types = restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("maxItems=10&skipCount=150")
|
||||
.getTypes();
|
||||
types.assertThat().entriesListCountIs(0);
|
||||
types.assertThat().paginationField("hasMoreItems").is("false");
|
||||
types.assertThat().paginationField("skipCount").is("150");
|
||||
types.assertThat().paginationField("maxItems").is("10");
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
}
|
@@ -15,6 +15,7 @@
|
||||
<package name="org.alfresco.rest.tags.*"/>
|
||||
<package name="org.alfresco.rest.trashcan.*"/>
|
||||
<package name="org.alfresco.rest.workflow.*"/>
|
||||
<package name="org.alfresco.rest.models.*"/>
|
||||
</packages>
|
||||
</test>
|
||||
</suite>
|
||||
|
4
pom.xml
4
pom.xml
@@ -102,9 +102,9 @@
|
||||
<dependency.postgresql.version>42.2.19</dependency.postgresql.version>
|
||||
<dependency.mysql.version>8.0.23</dependency.mysql.version>
|
||||
<dependency.mariadb.version>2.7.2</dependency.mariadb.version>
|
||||
<dependency.tas-utility.version>3.0.42</dependency.tas-utility.version>
|
||||
<dependency.tas-utility.version>3.0.43</dependency.tas-utility.version>
|
||||
<dependency.rest-assured.version>3.3.0</dependency.rest-assured.version>
|
||||
<dependency.tas-restapi.version>1.53</dependency.tas-restapi.version>
|
||||
<dependency.tas-restapi.version>1.54</dependency.tas-restapi.version>
|
||||
<dependency.tas-cmis.version>1.27</dependency.tas-cmis.version>
|
||||
<dependency.tas-email.version>1.8</dependency.tas-email.version>
|
||||
<dependency.tas-webdav.version>1.6</dependency.tas-webdav.version>
|
||||
|
Reference in New Issue
Block a user