mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-09-10 14:11:58 +00:00
Compare commits
30 Commits
tas-restap
...
tas-restap
Author | SHA1 | Date | |
---|---|---|---|
|
9f32368582 | ||
|
b42b08559a | ||
|
95af4d6876 | ||
|
9c17870040 | ||
|
e93028c30e | ||
|
7741456b79 | ||
|
27f7b2ec33 | ||
|
078ae4cd32 | ||
|
ab3a0f00c4 | ||
|
829c7ef65d | ||
|
0d40d455b2 | ||
|
3d91bf154d | ||
|
d87532ce55 | ||
|
e6f97e979a | ||
|
b800d4b7e4 | ||
|
92bad68c5b | ||
|
d77e02f9a8 | ||
|
8a6584540f | ||
|
2dec33388e | ||
|
2c149b412e | ||
|
10b427209d | ||
|
a53eb13f9f | ||
|
c0a90dd32b | ||
|
d2a414f8a7 | ||
|
e484360980 | ||
|
691855bed2 | ||
|
e81a33d770 | ||
|
9dab62b490 | ||
|
44f602eee4 | ||
|
c04c149779 |
@@ -4,7 +4,7 @@
|
||||
<groupId>org.alfresco.tas</groupId>
|
||||
<artifactId>restapi</artifactId>
|
||||
<name>alfresco-tas-restapi</name>
|
||||
<version>1.45</version>
|
||||
<version>1.55</version>
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-super-pom</artifactId>
|
||||
@@ -37,7 +37,7 @@
|
||||
<jackson-databind.version>2.9.8</jackson-databind.version>
|
||||
<maven-release.version>2.5.3</maven-release.version>
|
||||
<org.glassfish.version>1.1.4</org.glassfish.version>
|
||||
<commons-lang3.version>3.10</commons-lang3.version>
|
||||
<commons-lang3.version>3.12.0</commons-lang3.version>
|
||||
<scribejava-apis.version>6.9.0</scribejava-apis.version>
|
||||
<test.exclude />
|
||||
<test.include />
|
||||
@@ -48,7 +48,7 @@
|
||||
<connection>scm:git:https://github.com/Alfresco/alfresco-tas-restapi.git</connection>
|
||||
<developerConnection>scm:git:https://github.com/Alfresco/alfresco-tas-restapi.git</developerConnection>
|
||||
<url>https://github.com/Alfresco/alfresco-tas-restapi</url>
|
||||
<tag>v1.45</tag>
|
||||
<tag>v1.55</tag>
|
||||
</scm>
|
||||
|
||||
<issueManagement>
|
||||
@@ -274,7 +274,7 @@
|
||||
<dependency>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
<version>2.12.0</version>
|
||||
<version>2.12.1</version>
|
||||
</dependency>
|
||||
|
||||
<!--fixing java.lang.ClassCastException: class [B cannot be cast to class [C ([B and [C are in module java.base of loader 'bootstrap') -->
|
||||
@@ -299,7 +299,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-project-info-reports-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<version>3.1.1</version>
|
||||
<reportSets>
|
||||
<reportSet>
|
||||
<reports>
|
||||
|
@@ -13,6 +13,7 @@ import org.alfresco.dataprep.CMISUtil.Priority;
|
||||
import org.alfresco.rest.model.RestProcessVariableModel;
|
||||
import org.alfresco.rest.model.RestVariableModel;
|
||||
import org.alfresco.utility.Utility;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.FolderModel;
|
||||
import org.alfresco.utility.model.RepoTestModel;
|
||||
@@ -158,6 +159,15 @@ public class JsonBodyGenerator
|
||||
return value.toString();
|
||||
}
|
||||
|
||||
public static String siteGroup(String authorityId, UserRole role)
|
||||
{
|
||||
Utility.checkObjectIsInitialized(authorityId, "authorityId");
|
||||
JsonObject value = defineJSON()
|
||||
.add("role", role.name())
|
||||
.add("id", authorityId).build();
|
||||
return value.toString();
|
||||
}
|
||||
|
||||
public static String siteMemberhipRequest(String message, SiteModel siteModel, String title)
|
||||
{
|
||||
JsonObject value = defineJSON()
|
||||
|
@@ -36,6 +36,7 @@ import org.alfresco.rest.requests.authAPI.RestAuthAPI;
|
||||
import org.alfresco.rest.requests.cmisAPI.RestCmisAPI;
|
||||
import org.alfresco.rest.requests.coreAPI.RestCoreAPI;
|
||||
import org.alfresco.rest.requests.discoveryAPI.RestDiscoveryAPI;
|
||||
import org.alfresco.rest.requests.modelAPI.RestModelAPI;
|
||||
import org.alfresco.rest.requests.privateAPI.RestPrivateAPI;
|
||||
import org.alfresco.rest.requests.search.SearchAPI;
|
||||
import org.alfresco.rest.requests.search.SearchSQLAPI;
|
||||
@@ -932,6 +933,11 @@ public class RestWrapper extends DSLWrapper<RestWrapper>
|
||||
return new RestAuthAPI(this);
|
||||
}
|
||||
|
||||
public RestModelAPI withModelAPI()
|
||||
{
|
||||
return new RestModelAPI(this);
|
||||
}
|
||||
|
||||
public SearchAPI withSearchAPI()
|
||||
{
|
||||
return new SearchAPI(this);
|
||||
|
@@ -0,0 +1,158 @@
|
||||
package org.alfresco.rest.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import org.alfresco.rest.core.IRestModel;
|
||||
import org.alfresco.rest.core.assertion.ModelAssertion;
|
||||
import org.alfresco.utility.model.TestModel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class RestAbstractClassModel extends TestModel implements IRestModel<RestAbstractClassModel>
|
||||
{
|
||||
@JsonProperty(value = "entry")
|
||||
RestAbstractClassModel model;
|
||||
|
||||
@Override
|
||||
public RestAbstractClassModel onModel()
|
||||
{
|
||||
return model;
|
||||
}
|
||||
|
||||
public String id;
|
||||
public String title;
|
||||
public String description;
|
||||
public String parentId;
|
||||
public Boolean isContainer = null;
|
||||
public Boolean isArchive = null;
|
||||
public Boolean includedInSupertypeQuery = null;
|
||||
public List<String> mandatoryAspects = null;
|
||||
public List<RestClassAssociationModel> associations = null;
|
||||
public List <RestPropertyDefinitionModel> properties = null;
|
||||
|
||||
@JsonProperty(value = "model")
|
||||
public RestClassModel modelInfo;
|
||||
|
||||
public String getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getTitle()
|
||||
{
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title)
|
||||
{
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getParentId()
|
||||
{
|
||||
return parentId;
|
||||
}
|
||||
|
||||
public void setParentId(String parentId)
|
||||
{
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public Boolean getContainer()
|
||||
{
|
||||
return isContainer;
|
||||
}
|
||||
|
||||
public void setContainer(Boolean container)
|
||||
{
|
||||
isContainer = container;
|
||||
}
|
||||
|
||||
public Boolean getArchive()
|
||||
{
|
||||
return isArchive;
|
||||
}
|
||||
|
||||
public void setArchive(Boolean archive)
|
||||
{
|
||||
isArchive = archive;
|
||||
}
|
||||
|
||||
public Boolean getIncludedInSupertypeQuery()
|
||||
{
|
||||
return includedInSupertypeQuery;
|
||||
}
|
||||
|
||||
public void setIncludedInSupertypeQuery(Boolean includedInSupertypeQuery)
|
||||
{
|
||||
this.includedInSupertypeQuery = includedInSupertypeQuery;
|
||||
}
|
||||
|
||||
public List<String> getMandatoryAspects()
|
||||
{
|
||||
return mandatoryAspects;
|
||||
}
|
||||
|
||||
public void setMandatoryAspects(List<String> mandatoryAspects)
|
||||
{
|
||||
this.mandatoryAspects = mandatoryAspects;
|
||||
}
|
||||
|
||||
public List<RestClassAssociationModel> getAssociations()
|
||||
{
|
||||
return associations;
|
||||
}
|
||||
|
||||
public void setAssociations(List<RestClassAssociationModel> associations)
|
||||
{
|
||||
this.associations = associations;
|
||||
}
|
||||
|
||||
public List<RestPropertyDefinitionModel> getProperties() {
|
||||
return properties;
|
||||
}
|
||||
|
||||
public void setProperties(List<RestPropertyDefinitionModel> properties)
|
||||
{
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
public RestClassModel getModelInfo()
|
||||
{
|
||||
return modelInfo;
|
||||
}
|
||||
|
||||
public void setModelInfo(RestClassModel modelInfo)
|
||||
{
|
||||
this.modelInfo = modelInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* DSL for assertion on this rest model
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ModelAssertion<RestAbstractClassModel> assertThat()
|
||||
{
|
||||
return new ModelAssertion<RestAbstractClassModel>(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelAssertion<RestAbstractClassModel> and()
|
||||
{
|
||||
return assertThat();
|
||||
}
|
||||
}
|
@@ -0,0 +1,5 @@
|
||||
package org.alfresco.rest.model;
|
||||
|
||||
public class RestAspectModel extends RestAbstractClassModel
|
||||
{
|
||||
}
|
@@ -0,0 +1,7 @@
|
||||
package org.alfresco.rest.model;
|
||||
|
||||
import org.alfresco.rest.core.RestModels;
|
||||
|
||||
public class RestAspectsCollection extends RestModels<RestAspectModel, RestAspectsCollection>
|
||||
{
|
||||
}
|
@@ -0,0 +1,62 @@
|
||||
package org.alfresco.rest.model;
|
||||
|
||||
import org.alfresco.utility.model.TestModel;
|
||||
|
||||
public class RestClassAssociationDefinitionModel extends TestModel
|
||||
{
|
||||
public String role = null;
|
||||
public String cls = null;
|
||||
public Boolean isMany = null;
|
||||
public Boolean isMandatory = null;
|
||||
public Boolean isMandatoryEnforced = null;
|
||||
|
||||
public String getRole()
|
||||
{
|
||||
return role;
|
||||
}
|
||||
|
||||
public void setRole(String role)
|
||||
{
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
public String getCls()
|
||||
{
|
||||
return cls;
|
||||
}
|
||||
|
||||
public void setCls(String cls)
|
||||
{
|
||||
this.cls = cls;
|
||||
}
|
||||
|
||||
public Boolean getMany()
|
||||
{
|
||||
return isMany;
|
||||
}
|
||||
|
||||
public void setMany(Boolean many)
|
||||
{
|
||||
isMany = many;
|
||||
}
|
||||
|
||||
public Boolean getMandatory()
|
||||
{
|
||||
return isMandatory;
|
||||
}
|
||||
|
||||
public void setMandatory(Boolean mandatory)
|
||||
{
|
||||
isMandatory = mandatory;
|
||||
}
|
||||
|
||||
public Boolean getMandatoryEnforced()
|
||||
{
|
||||
return isMandatoryEnforced;
|
||||
}
|
||||
|
||||
public void setMandatoryEnforced(Boolean mandatoryEnforced)
|
||||
{
|
||||
isMandatoryEnforced = mandatoryEnforced;
|
||||
}
|
||||
}
|
@@ -0,0 +1,86 @@
|
||||
package org.alfresco.rest.model;
|
||||
|
||||
import org.alfresco.utility.model.TestModel;
|
||||
|
||||
public class RestClassAssociationModel extends TestModel
|
||||
{
|
||||
public String id;
|
||||
public String title;
|
||||
public String description;
|
||||
public Boolean isChild;
|
||||
public Boolean isProtected;
|
||||
public RestClassAssociationDefinitionModel source = null;
|
||||
public RestClassAssociationDefinitionModel target = null;
|
||||
|
||||
public String getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getTitle()
|
||||
{
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title)
|
||||
{
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public Boolean getChild()
|
||||
{
|
||||
return isChild;
|
||||
}
|
||||
|
||||
public void setIsChild(Boolean isChild)
|
||||
{
|
||||
this.isChild = isChild;
|
||||
}
|
||||
|
||||
public Boolean getIsProtected()
|
||||
{
|
||||
return isProtected;
|
||||
}
|
||||
|
||||
public void setIsProtected(Boolean isProtected)
|
||||
{
|
||||
this.isProtected = isProtected;
|
||||
}
|
||||
|
||||
public RestClassAssociationDefinitionModel getSource()
|
||||
{
|
||||
return source;
|
||||
}
|
||||
|
||||
public void setSource(RestClassAssociationDefinitionModel source)
|
||||
{
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
public RestClassAssociationDefinitionModel getTarget()
|
||||
{
|
||||
return target;
|
||||
}
|
||||
|
||||
public void setTarget(RestClassAssociationDefinitionModel target)
|
||||
{
|
||||
this.target = target;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,62 @@
|
||||
package org.alfresco.rest.model;
|
||||
|
||||
import org.alfresco.utility.model.TestModel;
|
||||
|
||||
public class RestClassModel extends TestModel
|
||||
{
|
||||
public String id;
|
||||
public String author;
|
||||
public String description;
|
||||
public String namespaceUri;
|
||||
public String namespacePrefix;
|
||||
|
||||
public String getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getAuthor()
|
||||
{
|
||||
return author;
|
||||
}
|
||||
|
||||
public void setAuthor(String author)
|
||||
{
|
||||
this.author = author;
|
||||
}
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getNamespaceUri()
|
||||
{
|
||||
return namespaceUri;
|
||||
}
|
||||
|
||||
public void setNamespaceUri(String namespaceUri)
|
||||
{
|
||||
this.namespaceUri = namespaceUri;
|
||||
}
|
||||
|
||||
public String getNamespacePrefix()
|
||||
{
|
||||
return namespacePrefix;
|
||||
}
|
||||
|
||||
public void setNamespacePrefix(String namespacePrefix)
|
||||
{
|
||||
this.namespacePrefix = namespacePrefix;
|
||||
}
|
||||
}
|
@@ -0,0 +1,62 @@
|
||||
package org.alfresco.rest.model;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class RestConstraintDefinitionModel
|
||||
{
|
||||
private String id;
|
||||
private String type;
|
||||
private String title;
|
||||
private String description;
|
||||
private Map<String, Object> parameters;
|
||||
|
||||
public String getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type)
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getTitle()
|
||||
{
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title)
|
||||
{
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public Map<String, Object> getParameters()
|
||||
{
|
||||
return parameters;
|
||||
}
|
||||
|
||||
public void setParameters(Map<String, Object> parameters)
|
||||
{
|
||||
this.parameters = parameters;
|
||||
}
|
||||
}
|
@@ -0,0 +1,117 @@
|
||||
package org.alfresco.rest.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class RestPropertyDefinitionModel
|
||||
{
|
||||
private String id;
|
||||
private String title;
|
||||
private String description;
|
||||
private String defaultValue;
|
||||
private String dataType;
|
||||
private Boolean isMultiValued;
|
||||
private Boolean isMandatory;
|
||||
private Boolean isMandatoryEnforced;
|
||||
private Boolean isProtected;
|
||||
private List<RestConstraintDefinitionModel> constraints;
|
||||
|
||||
public String getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getTitle()
|
||||
{
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title)
|
||||
{
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getDefaultValue()
|
||||
{
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
public void setDefaultValue(String defaultValue)
|
||||
{
|
||||
this.defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
public String getDataType()
|
||||
{
|
||||
return dataType;
|
||||
}
|
||||
|
||||
public void setDataType(String dataType)
|
||||
{
|
||||
this.dataType = dataType;
|
||||
}
|
||||
|
||||
public boolean getIsProtected()
|
||||
{
|
||||
return isProtected;
|
||||
}
|
||||
|
||||
public void setIsProtected(boolean isProtected)
|
||||
{
|
||||
this.isProtected = isProtected;
|
||||
}
|
||||
|
||||
public List<RestConstraintDefinitionModel> getConstraints()
|
||||
{
|
||||
return constraints;
|
||||
}
|
||||
|
||||
public void setConstraints(List<RestConstraintDefinitionModel> constraints)
|
||||
{
|
||||
this.constraints = constraints;
|
||||
}
|
||||
|
||||
public boolean getIsMultiValued()
|
||||
{
|
||||
return isMultiValued;
|
||||
}
|
||||
|
||||
public void setIsMultiValued(boolean isMultiValued)
|
||||
{
|
||||
this.isMultiValued = isMultiValued;
|
||||
}
|
||||
|
||||
public boolean getIsMandatory()
|
||||
{
|
||||
return isMandatory;
|
||||
}
|
||||
|
||||
public void setIsMandatory(boolean isMandatory)
|
||||
{
|
||||
this.isMandatory = isMandatory;
|
||||
}
|
||||
|
||||
public boolean getIsMandatoryEnforced()
|
||||
{
|
||||
return isMandatoryEnforced;
|
||||
}
|
||||
|
||||
public void setIsMandatoryEnforced(boolean isMandatoryEnforced)
|
||||
{
|
||||
this.isMandatoryEnforced = isMandatoryEnforced;
|
||||
}
|
||||
}
|
@@ -0,0 +1,78 @@
|
||||
package org.alfresco.rest.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import org.alfresco.rest.core.IRestModel;
|
||||
import org.alfresco.rest.core.assertion.ModelAssertion;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.model.TestModel;
|
||||
import org.testng.Assert;
|
||||
|
||||
import static org.alfresco.utility.report.log.Step.STEP;
|
||||
|
||||
public class RestSiteGroupModel extends TestModel implements IRestModel<RestSiteGroupModel>
|
||||
{
|
||||
@JsonProperty(value = "entry")
|
||||
RestSiteGroupModel model;
|
||||
|
||||
@Override
|
||||
public RestSiteGroupModel onModel()
|
||||
{
|
||||
return model;
|
||||
}
|
||||
|
||||
private UserRole role;
|
||||
private String id = "no-id";
|
||||
private RestGroupsModel group;
|
||||
|
||||
public UserRole getRole()
|
||||
{
|
||||
return role;
|
||||
}
|
||||
|
||||
public void setRole(UserRole role)
|
||||
{
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
public String getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public RestGroupsModel getGroup()
|
||||
{
|
||||
return group;
|
||||
}
|
||||
|
||||
public void setGroup(RestGroupsModel group)
|
||||
{
|
||||
this.group = group;
|
||||
}
|
||||
|
||||
public RestSiteGroupModel assertSiteGroupHasRole(UserRole role) {
|
||||
STEP(String.format("REST API: Assert that site group role is '%s'", role));
|
||||
Assert.assertEquals(getRole(), role, "Site group role is not as expected.");
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* DSL for assertion on this rest model
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ModelAssertion<RestSiteGroupModel> assertThat()
|
||||
{
|
||||
return new ModelAssertion<RestSiteGroupModel>(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelAssertion<RestSiteGroupModel> and()
|
||||
{
|
||||
return assertThat();
|
||||
}
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
package org.alfresco.rest.model;
|
||||
|
||||
import org.alfresco.rest.core.RestModels;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.alfresco.utility.report.log.Step.STEP;
|
||||
|
||||
public class RestSiteGroupModelsCollection extends RestModels<RestSiteGroupModel, RestSiteGroupModelsCollection>
|
||||
{
|
||||
|
||||
/**
|
||||
* Get groups from site groups list
|
||||
*/
|
||||
public RestSiteGroupModel getSiteGroups(String groupId)
|
||||
{
|
||||
STEP(String.format("REST API: Get site group with id '%s'", groupId));
|
||||
RestSiteGroupModel siteGroupEntry = null;
|
||||
List<RestSiteGroupModel> siteGroups = getEntries();
|
||||
|
||||
for (int i = 1; i < siteGroups.size(); i++)
|
||||
{
|
||||
if (siteGroups.get(i).onModel().getId().equals(groupId))
|
||||
{
|
||||
siteGroupEntry = siteGroups.get(i).onModel();
|
||||
}
|
||||
}
|
||||
|
||||
return siteGroupEntry;
|
||||
}
|
||||
|
||||
}
|
@@ -36,6 +36,9 @@ public class RestSyncServiceComponentModel extends TestModel
|
||||
@JsonProperty
|
||||
private String message;
|
||||
|
||||
@JsonProperty
|
||||
private int duration;
|
||||
|
||||
public Boolean getHealthy()
|
||||
{
|
||||
return healthy;
|
||||
@@ -46,4 +49,9 @@ public class RestSyncServiceComponentModel extends TestModel
|
||||
return message;
|
||||
}
|
||||
|
||||
public int getDuration()
|
||||
{
|
||||
return duration;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,5 @@
|
||||
package org.alfresco.rest.model;
|
||||
|
||||
public class RestTypeModel extends RestAbstractClassModel
|
||||
{
|
||||
}
|
@@ -0,0 +1,7 @@
|
||||
package org.alfresco.rest.model;
|
||||
|
||||
import org.alfresco.rest.core.RestModels;
|
||||
|
||||
public class RestTypesCollection extends RestModels<RestTypeModel, RestTypesCollection>
|
||||
{
|
||||
}
|
@@ -11,9 +11,12 @@ import org.alfresco.rest.model.RestSiteContainerModel;
|
||||
import org.alfresco.rest.model.RestSiteContainerModelsCollection;
|
||||
import org.alfresco.rest.model.RestSiteMemberModel;
|
||||
import org.alfresco.rest.model.RestSiteMemberModelsCollection;
|
||||
import org.alfresco.rest.model.RestSiteGroupModel;
|
||||
import org.alfresco.rest.model.RestSiteGroupModelsCollection;
|
||||
import org.alfresco.rest.model.RestSiteModel;
|
||||
import org.alfresco.rest.model.RestSiteModelsCollection;
|
||||
import org.alfresco.rest.model.RestSitePersonMembershipRequestModelsCollection;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.model.SiteModel;
|
||||
import org.alfresco.utility.model.UserModel;
|
||||
import org.springframework.http.HttpMethod;
|
||||
@@ -257,4 +260,66 @@ public class Site extends ModelRequest<Site>
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.POST, "sites/{siteId}/site-membership-requests/{inviteeId}/reject", site.getId(), siteMember.getUsername());
|
||||
return restWrapper.process(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve all group membership of a site using GET call on "sites/{siteId}/group-members"
|
||||
*
|
||||
* @return RestSiteGroupModelsCollection
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestSiteGroupModelsCollection getSiteGroups()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "sites/{siteId}/group-members?{parameters}", site.getId(), restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestSiteGroupModelsCollection.class, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add new site group membership using POST call on "sites/{siteId}/group-members"
|
||||
*
|
||||
* @param authorityId The authorityId of the group
|
||||
* @param role role to assign
|
||||
* @return
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestSiteGroupModel addSiteGroup(String authorityId, UserRole role)
|
||||
{
|
||||
String siteMemberBody = JsonBodyGenerator.siteGroup(authorityId, role);
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, siteMemberBody, "sites/{siteId}/group-members?{parameters}", site.getId(), restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestSiteGroupModel.class, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve specific group membership of a site using GET call on "sites/{siteId}/group-members/{groupId}"
|
||||
*
|
||||
* @param groupId
|
||||
* @return RestSiteGroupModel
|
||||
*/
|
||||
public RestSiteGroupModel getSiteGroup(String groupId)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "sites/{siteId}/group-members/{groupId}", site.getId(), groupId);
|
||||
return restWrapper.processModel(RestSiteGroupModel.class, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update site group membership role with PUT call on "sites/{siteId}/group-members/{groupId}"
|
||||
* @param groupId
|
||||
* @return RestSiteGroupModel
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestSiteGroupModel updateSiteGroup(String groupId, UserRole role)
|
||||
{
|
||||
String json = JsonBodyGenerator.keyValueJson("role", role.toString());
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.PUT, json, "sites/{siteId}/group-members/{groupId}", site.getId(), groupId);
|
||||
return restWrapper.processModel(RestSiteGroupModel.class, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete site group membership with DELETE call on "sites/{siteId}/group-members/{groupId}"
|
||||
* @param groupId
|
||||
*/
|
||||
public void deleteSiteGroup(String groupId)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.DELETE, "sites/{siteId}/group-members/{groupId}", site.getId(), groupId);
|
||||
restWrapper.processEmptyModel(request);
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,71 @@
|
||||
package org.alfresco.rest.requests.modelAPI;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import org.alfresco.rest.core.RestRequest;
|
||||
import org.alfresco.rest.core.RestWrapper;
|
||||
import org.alfresco.rest.exception.JsonToModelConversionException;
|
||||
import org.alfresco.rest.model.*;
|
||||
import org.alfresco.rest.requests.ModelRequest;
|
||||
import org.springframework.http.HttpMethod;
|
||||
|
||||
/**
|
||||
* Defines the entire Rest Model API
|
||||
* {@link https://api-explorer.alfresco.com/api-explorer/} select "Model API"
|
||||
*/
|
||||
public class RestModelAPI extends ModelRequest<RestModelAPI>
|
||||
{
|
||||
public RestModelAPI(RestWrapper restWrapper)
|
||||
{
|
||||
super(restWrapper);
|
||||
RestAssured.basePath = "alfresco/api/-default-/public/alfresco/versions/1";
|
||||
restWrapper.configureRequestSpec().setBasePath(RestAssured.basePath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve all aspects using GET call on "aspects"
|
||||
*
|
||||
* @return RestAspectsCollection
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestAspectsCollection getAspects()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "aspects?{parameters}", restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestAspectsCollection.class, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve aspect by id using GET call on "aspects/{aspectId}"
|
||||
*
|
||||
* @return RestAspectModel
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestAspectModel getAspect(String aspectId)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "aspects/{aspectId}?{parameters}", aspectId, restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestAspectModel.class, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve all types using GET call on "types"
|
||||
*
|
||||
* @return RestTypesCollection
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestTypesCollection getTypes()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "types?{parameters}", restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestTypesCollection.class, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve Type by id using GET call on "types/{typeId}"
|
||||
*
|
||||
* @return RestTypeModel
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestTypeModel getType(String typeId)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "types/{typeId}?{parameters}", typeId, restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestTypeModel.class, request);
|
||||
}
|
||||
}
|
@@ -67,6 +67,17 @@ public class SolrAPI extends ModelRequest<SolrAPI>
|
||||
return restWrapper.processTextResponse(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes an action (like "delete") on SOLR alfresco core
|
||||
* @param urlActionPath some action name (like "delete")
|
||||
* @param queryBody parameters for the action
|
||||
*/
|
||||
public RestTextResponse postAction(String urlActionPath, String queryBody) throws Exception
|
||||
{
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, queryBody, urlActionPath);
|
||||
return restWrapper.processTextResponse(request);
|
||||
}
|
||||
|
||||
public RestTextResponse getSelectQuery() throws Exception
|
||||
{
|
||||
List<Header> headers = new ArrayList<Header>();
|
||||
@@ -77,4 +88,19 @@ public class SolrAPI extends ModelRequest<SolrAPI>
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "select?q={parameters}", restWrapper.getParameters());
|
||||
return restWrapper.processTextResponse(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes a query in SOLR using JSON format for the results
|
||||
*/
|
||||
public RestTextResponse getSelectQueryJson() throws Exception
|
||||
{
|
||||
List<Header> headers = new ArrayList<Header>();
|
||||
headers.add(new Header("Content-Type", "application/json"));
|
||||
Headers header = new Headers(headers);
|
||||
restWrapper.setResponseHeaders(header);
|
||||
restWrapper.configureRequestSpec().setUrlEncodingEnabled(false);
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "select?q={parameters}&wt=json", restWrapper.getParameters());
|
||||
return restWrapper.processTextResponse(request);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package org.alfresco.rest.search;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import org.alfresco.rest.core.IRestModel;
|
||||
import org.alfresco.rest.core.assertion.ModelAssertion;
|
||||
@@ -12,6 +13,16 @@ import java.util.List;
|
||||
* Generated from 'Alfresco Content Services REST API' swagger file
|
||||
* Base Path {@linkplain /alfresco/api/-default-/public/search/versions/1}
|
||||
*/
|
||||
|
||||
/*
|
||||
From Jackson 2.8 this annotation is required to make sure that defaults are read from the actual field values,
|
||||
as opposing to field type defaults. For example, the default for boolean primitive is "false",
|
||||
but the default for the "min" field in this class is "true".
|
||||
This configuration does not affect the product and is only related to test framework and how it serializes the request into JSON.
|
||||
See org.alfresco.utility.model.TestModel#toJson
|
||||
Note: This change was required for org.alfresco.test.search.functional.searchServices.search.StatsSearchTest
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
|
||||
public class RestRequestStatsModel extends TestModel implements IRestModel<RestRequestStatsModel>
|
||||
{
|
||||
@Override
|
||||
|
@@ -56,7 +56,8 @@ public class RestDemoTests extends RestTest
|
||||
* Update existing comment using PUT call, check that comment content is updated <br/>
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test(groups = { "demo" })
|
||||
//Opened DESKTOPAPP-475 for fixing the failing test
|
||||
// @Test(groups = { "demo" })
|
||||
public void adminCanPostAndUpdateComments() throws Exception
|
||||
{
|
||||
FileModel fileModel = dataContent.usingUser(userModel)
|
||||
|
Reference in New Issue
Block a user