mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-09-10 14:11:58 +00:00
Compare commits
122 Commits
tas-restap
...
tas-restap
Author | SHA1 | Date | |
---|---|---|---|
|
3aec98cb92 | ||
|
cfd0dd388e | ||
|
8aadb2baf1 | ||
|
ca6b4cce24 | ||
|
eb2c76f600 | ||
|
fa910faea6 | ||
|
d428c542fc | ||
|
d0d5ce8d9d | ||
|
3e4a3a0a31 | ||
|
7d5f01f3d5 | ||
|
1ae1f87cdf | ||
|
a5ceb3df00 | ||
|
18dc254813 | ||
|
b737775fd3 | ||
|
175a525b64 | ||
|
8dba7f9468 | ||
|
838794f274 | ||
|
917961569d | ||
|
8e1c10aae0 | ||
|
580dda50e6 | ||
|
d0bc3f1ece | ||
|
a05f2eb20f | ||
|
51029868a9 | ||
|
e0b1c6f776 | ||
|
9930f18291 | ||
|
ca785cda74 | ||
|
308a60dcfa | ||
|
2518910fe1 | ||
|
4ddfb16bff | ||
|
ffb4df068b | ||
|
7fdb040b50 | ||
|
c2e587d640 | ||
|
bed12e40ca | ||
|
a53daf152f | ||
|
cc03aaf92f | ||
|
f9102eae0d | ||
|
8f252b69f1 | ||
|
50f884556c | ||
|
b1ad95a756 | ||
|
581f82f332 | ||
|
80fda4ed56 | ||
|
086ca9229e | ||
|
6d84baa34e | ||
|
d048054903 | ||
|
faf6cafe5a | ||
|
13a134da27 | ||
|
5e93e937f9 | ||
|
36c830ecdb | ||
|
013f3fac1c | ||
|
ec675d6123 | ||
|
e115c673e1 | ||
|
2453b3c9c7 | ||
|
761554ad83 | ||
|
20738f6ac5 | ||
|
1a90c129bc | ||
|
76ba1ce813 | ||
|
91bb8651d3 | ||
|
bbdc41555c | ||
|
1d77e2e852 | ||
|
8155132d69 | ||
|
d0e94e0d68 | ||
|
5c50dbef83 | ||
|
ef6d2531fb | ||
|
0c3c584ed9 | ||
|
516d15796f | ||
|
c2a2541a62 | ||
|
397979a4f9 | ||
|
ec85dd7e61 | ||
|
69ccd06cf2 | ||
|
6002440be5 | ||
|
1973a9d578 | ||
|
8d1e16e9c2 | ||
|
9e0b26f612 | ||
|
9080d3e0d9 | ||
|
f916a625d0 | ||
|
e0c278e277 | ||
|
bb64b05534 | ||
|
28be182040 | ||
|
ee88b0bf0c | ||
|
cd60067bbf | ||
|
bd64391527 | ||
|
126ece3dbe | ||
|
f7b7eeaf56 | ||
|
53937c963c | ||
|
671116b500 | ||
|
82369a3dcf | ||
|
9e9caec601 | ||
|
27caf48c79 | ||
|
e1b1e66e8d | ||
|
9186cead13 | ||
|
6c2d084209 | ||
|
81e0cb939d | ||
|
2bd64e48b5 | ||
|
3d6c34c8d6 | ||
|
506dd32b31 | ||
|
70ed927b3c | ||
|
3c818df7f1 | ||
|
612b65798e | ||
|
d0724a0a06 | ||
|
beea540ad0 | ||
|
099e1328c0 | ||
|
0f01dea5d2 | ||
|
38edaf79c2 | ||
|
d7e7545482 | ||
|
2cdcc7d5ce | ||
|
de7431b917 | ||
|
14e500cb1f | ||
|
4c37f4cda6 | ||
|
8470a1962b | ||
|
914ad394c3 | ||
|
1668baac05 | ||
|
17118db32f | ||
|
13f6aa2044 | ||
|
f6b3b62841 | ||
|
46c59e50f6 | ||
|
7870db5370 | ||
|
78a8d8d6cb | ||
|
60083c6145 | ||
|
c9a6c633ed | ||
|
1de92e61c4 | ||
|
e246eb31cf | ||
|
4261615fb4 |
@@ -22,7 +22,7 @@ jobs:
|
||||
include:
|
||||
- stage: test
|
||||
name: "Build and test"
|
||||
script: travis_retry mvn test
|
||||
script: travis_retry mvn test -Dtest=ModelAssertionTest
|
||||
- stage: release
|
||||
name: "Push to Nexus"
|
||||
if: fork = false AND branch = master AND type != pull_request AND commit_message !~ /\[no-release\]/
|
||||
@@ -31,5 +31,7 @@ jobs:
|
||||
script:
|
||||
# Use full history for release
|
||||
- git checkout -B "${TRAVIS_BRANCH}"
|
||||
# Add email to link commits to user
|
||||
- git config user.email "${GIT_EMAIL}"
|
||||
# Skip building of release commits
|
||||
- mvn --batch-mode -DscmCommentPrefix="[maven-release-plugin][skip ci] " -Dusername="${GIT_USERNAME}" -Dpassword="${GIT_PASSWORD}" -DskipTests -Darguments=-DskipTests release:clean release:prepare release:perform
|
||||
- mvn --batch-mode -DscmCommentPrefix="[maven-release-plugin][skip ci] " -Dusername="${GIT_USERNAME}" -Dpassword="${GIT_PASSWORD}" -DskipTests -Darguments=-DskipTests release:clean release:prepare release:perform
|
||||
|
@@ -4,7 +4,7 @@
|
||||
<groupId>org.alfresco.tas</groupId>
|
||||
<artifactId>restapi</artifactId>
|
||||
<name>alfresco-tas-restapi</name>
|
||||
<version>1.6</version>
|
||||
<version>1.41</version>
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-super-pom</artifactId>
|
||||
@@ -28,19 +28,17 @@
|
||||
<suiteXmlFile>src/main/resources/shared-resources/testCount.xml</suiteXmlFile>
|
||||
<maven.build.sourceVersion>11</maven.build.sourceVersion>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<tas.utility.version>3.0.0</tas.utility.version>
|
||||
<tas.utility.version>3.0.20</tas.utility.version>
|
||||
<rest-assured.version>3.3.0</rest-assured.version>
|
||||
<httpclient-osgi-version>4.5.2</httpclient-osgi-version>
|
||||
<httpclient-osgi-version>4.5.3</httpclient-osgi-version>
|
||||
<json-path.version>3.3.0</json-path.version>
|
||||
<xml-path.version>3.3.0</xml-path.version>
|
||||
<json-schema-validator.version>3.3.0</json-schema-validator.version>
|
||||
<jackson-databind.version>2.9.8</jackson-databind.version>
|
||||
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
|
||||
<maven-release.version>2.5.3</maven-release.version>
|
||||
<org.glassfish.version>1.0.4</org.glassfish.version>
|
||||
<maven-remote-resources.version>1.6.0</maven-remote-resources.version>
|
||||
<commons-lang3.version>3.8</commons-lang3.version>
|
||||
<scribejava-apis.version>6.5.1</scribejava-apis.version>
|
||||
<org.glassfish.version>1.1.4</org.glassfish.version>
|
||||
<commons-lang3.version>3.10</commons-lang3.version>
|
||||
<scribejava-apis.version>6.9.0</scribejava-apis.version>
|
||||
<test.exclude />
|
||||
<test.include />
|
||||
<java.version>11</java.version>
|
||||
@@ -50,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.6</tag>
|
||||
<tag>v1.41</tag>
|
||||
</scm>
|
||||
|
||||
<issueManagement>
|
||||
@@ -95,39 +93,6 @@
|
||||
<tagNameFormat>v@{project.version}</tagNameFormat>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>test-jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-remote-resources-plugin</artifactId>
|
||||
<version>${maven-remote-resources.version}</version>
|
||||
<configuration>
|
||||
<includes>
|
||||
<include>shared-resources/**/*</include>
|
||||
</includes>
|
||||
<resourceBundles>
|
||||
<resourceBundle>org.alfresco.tas:utility:${tas.utility.version}</resourceBundle>
|
||||
</resourceBundles>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>process</goal>
|
||||
<goal>bundle</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
@@ -163,18 +128,6 @@
|
||||
</arguments>
|
||||
<mainClass>org.alfresco.rest.core.swagger.Generator</mainClass>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
@@ -196,14 +149,6 @@
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<includes>
|
||||
<include>shared-resources/**/*</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
@@ -212,7 +157,7 @@
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
<version>2.4</version>
|
||||
<version>2.5</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -310,7 +255,7 @@
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.7.2</version>
|
||||
<version>1.7.30</version>
|
||||
</dependency>
|
||||
|
||||
<!-- swagger parser -->
|
||||
@@ -337,14 +282,14 @@
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<artifactId>groovy</artifactId>
|
||||
<version>2.5.5</version>
|
||||
<version>2.5.9</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.codehaus.groovy/groovy-json-->
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<artifactId>groovy-json</artifactId>
|
||||
<version>2.5.5</version>
|
||||
<version>2.5.9</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
@@ -354,7 +299,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-project-info-reports-plugin</artifactId>
|
||||
<version>3.0.0</version>
|
||||
<version>3.1.0</version>
|
||||
<reportSets>
|
||||
<reportSet>
|
||||
<reports>
|
||||
|
@@ -149,7 +149,7 @@ public class JsonBodyGenerator
|
||||
}
|
||||
|
||||
|
||||
public static String siteMember(UserModel userModel) throws Exception
|
||||
public static String siteMember(UserModel userModel)
|
||||
{
|
||||
Utility.checkObjectIsInitialized(userModel.getUserRole(), "userModel.getUserRole()");
|
||||
JsonObject value = defineJSON()
|
||||
@@ -166,6 +166,19 @@ public class JsonBodyGenerator
|
||||
.add("title", title).build();
|
||||
return value.toString();
|
||||
}
|
||||
/**
|
||||
* Method to create a Json object for SiteBody with site title, description, visibility
|
||||
* @param siteModel
|
||||
* @return String
|
||||
*/
|
||||
public static String updateSiteRequest(SiteModel siteModel)
|
||||
{
|
||||
JsonObject value = defineJSON()
|
||||
.add("title", siteModel.getTitle())
|
||||
.add("description", siteModel.getDescription())
|
||||
.add("visibility", siteModel.getVisibility().toString()).build();
|
||||
return value.toString();
|
||||
}
|
||||
|
||||
public static String process(String processDefinitionKey, UserModel assignee, boolean sendEmailNotifications, Priority priority)
|
||||
{
|
||||
|
@@ -42,6 +42,7 @@ import org.alfresco.rest.requests.search.SearchSQLAPI;
|
||||
import org.alfresco.rest.requests.search.SearchSQLJDBC;
|
||||
import org.alfresco.rest.requests.search.ShardInfoAPI;
|
||||
import org.alfresco.rest.requests.search.SolrAPI;
|
||||
import org.alfresco.rest.requests.search.SolrAdminAPI;
|
||||
import org.alfresco.rest.requests.workflowAPI.RestWorkflowAPI;
|
||||
import org.alfresco.utility.LogFactory;
|
||||
import org.alfresco.utility.Utility;
|
||||
@@ -96,6 +97,23 @@ public class RestWrapper extends DSLWrapper<RestWrapper>
|
||||
private RequestSpecBuilder requestSpecBuilder = new RequestSpecBuilder();
|
||||
private Headers responseHeaders;
|
||||
private RestResponse response;
|
||||
private String serverURI;
|
||||
private int serverPort;
|
||||
|
||||
/**
|
||||
* After configuring {@link #setServerURI(String)} and {@link #setServerPort(int)} call {@link #configureServerEndpoint()}
|
||||
*
|
||||
* @param serverURI in format of "http://localhost", without port. Set port via {@link #setServerPort(int)}
|
||||
*/
|
||||
public void setServerURI(String serverURI)
|
||||
{
|
||||
this.serverURI = serverURI;
|
||||
}
|
||||
|
||||
public void setServerPort(int serverPort)
|
||||
{
|
||||
this.serverPort = serverPort;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private RestAisAuthentication aisAuthentication;
|
||||
@@ -131,11 +149,9 @@ public class RestWrapper extends DSLWrapper<RestWrapper>
|
||||
@PostConstruct
|
||||
public void initializeRequestSpecBuilder()
|
||||
{
|
||||
requestSpecBuilder = new RequestSpecBuilder();
|
||||
RestAssured.baseURI = restProperties.envProperty().getTestServerUrl();
|
||||
RestAssured.port = restProperties.envProperty().getPort();
|
||||
configureRequestSpec().setBaseUri(restProperties.envProperty().getTestServerUrl());
|
||||
configureRequestSpec().setPort(restProperties.envProperty().getPort());
|
||||
this.serverURI = restProperties.envProperty().getTestServerUrl();
|
||||
this.serverPort = restProperties.envProperty().getPort();
|
||||
configureServerEndpoint();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -348,10 +364,8 @@ public class RestWrapper extends DSLWrapper<RestWrapper>
|
||||
|
||||
/**
|
||||
* Process responses for site relations models, such as {@link RestSiteModel, RestSiteContainerModelsCollection, RestSiteMemberModelsCollection}
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<Object> processRelationsJson(RestRequest restRequest) throws Exception
|
||||
public List<Object> processRelationsJson(RestRequest restRequest)
|
||||
{
|
||||
List<Object> jsonObjects = new ArrayList<Object>();
|
||||
Response returnedResponse = sendRequest(restRequest);
|
||||
@@ -401,10 +415,8 @@ public class RestWrapper extends DSLWrapper<RestWrapper>
|
||||
|
||||
/**
|
||||
* Process responses for site relations models, such as {@link RestSiteModel, RestSiteContainerModelsCollection, RestSiteMemberModelsCollection}
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<List<Object>> processSitesRelationsJson(RestRequest restRequest) throws Exception
|
||||
public List<List<Object>> processSitesRelationsJson(RestRequest restRequest)
|
||||
{
|
||||
List<List<Object>> allObjects = new ArrayList<List<Object>>();
|
||||
List<Object> sitesList = new ArrayList<Object>();
|
||||
@@ -621,7 +633,7 @@ public class RestWrapper extends DSLWrapper<RestWrapper>
|
||||
|
||||
logResponseInformation(restRequest, returnedResponse);
|
||||
|
||||
initializeRequestSpecBuilder();
|
||||
configureServerEndpoint();
|
||||
response = new RestResponse(returnedResponse);
|
||||
return returnedResponse;
|
||||
}
|
||||
@@ -944,6 +956,11 @@ public class RestWrapper extends DSLWrapper<RestWrapper>
|
||||
{
|
||||
return new SolrAPI(this);
|
||||
}
|
||||
|
||||
public SolrAdminAPI withSolrAdminAPI()
|
||||
{
|
||||
return new SolrAdminAPI(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link RestDiscoveryAPI} using the rest Discovery API as prefix: {@link /alfresco/api/discovery}
|
||||
@@ -1096,17 +1113,42 @@ public class RestWrapper extends DSLWrapper<RestWrapper>
|
||||
|
||||
public void configureSyncServiceEndPoint()
|
||||
{
|
||||
RestAssured.baseURI = restProperties.envProperty().getSyncServerUrl();
|
||||
RestAssured.port = restProperties.envProperty().getSyncPort();
|
||||
configureRequestSpec().setBaseUri(restProperties.envProperty().getSyncServerUrl());
|
||||
configureRequestSpec().setPort(restProperties.envProperty().getSyncPort());
|
||||
this.serverURI = restProperties.envProperty().getSyncServerUrl();
|
||||
this.serverPort = restProperties.envProperty().getSyncPort();
|
||||
configureServerEndpoint();
|
||||
}
|
||||
|
||||
public void configureSolrEndPoint()
|
||||
{
|
||||
RestAssured.baseURI = restProperties.envProperty().getSolrServerUrl();
|
||||
RestAssured.port = restProperties.envProperty().getSolrPort();
|
||||
configureRequestSpec().setBaseUri(restProperties.envProperty().getSolrServerUrl());
|
||||
configureRequestSpec().setPort(restProperties.envProperty().getSolrPort());
|
||||
this.serverURI = restProperties.envProperty().getSolrServerUrl();
|
||||
this.serverPort = restProperties.envProperty().getSolrPort();
|
||||
configureServerEndpoint();
|
||||
}
|
||||
|
||||
/**
|
||||
* Use {@link #setServerURI(String)} and {@link #setServerPort(int)}
|
||||
*/
|
||||
public void configureServerEndpoint()
|
||||
{
|
||||
requestSpecBuilder = new RequestSpecBuilder();
|
||||
|
||||
// use static variables for logs, etc
|
||||
// the request spec is built from data set via setters, see RestWrapper#onRequest
|
||||
RestAssured.baseURI = this.serverURI;
|
||||
RestAssured.port = this.serverPort;
|
||||
|
||||
configureRequestSpec().setBaseUri(this.serverURI);
|
||||
configureRequestSpec().setPort(this.serverPort);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adding new method to configure Alfresco Endpoint.
|
||||
* Reconfiguration is required when restClient is used to executed apis on different <host>:<port> e.g. solr api followed by search api
|
||||
*/
|
||||
public void configureAlfrescoEndpoint()
|
||||
{
|
||||
this.serverURI = restProperties.envProperty().getTestServerUrl();
|
||||
this.serverPort = restProperties.envProperty().getPort();
|
||||
configureServerEndpoint();
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
package org.alfresco.rest.exception;
|
||||
|
||||
public class ModelToJsonConversionException extends RuntimeException
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public <T> ModelToJsonConversionException(Class<T> classz, Exception e)
|
||||
{
|
||||
super(String.format("Could not convert model for [%s] to JSON", classz.getName()), e);
|
||||
}
|
||||
}
|
@@ -0,0 +1,120 @@
|
||||
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.CustomAspectPropertiesModel;
|
||||
import org.alfresco.utility.model.TestModel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Bogdan Bocancea
|
||||
*/
|
||||
public class RestCustomTypeModel extends TestModel implements IRestModel<RestCustomTypeModel>
|
||||
{
|
||||
@JsonProperty(value = "entry")
|
||||
RestCustomTypeModel model;
|
||||
|
||||
@JsonProperty(required = true)
|
||||
private String name;
|
||||
|
||||
@JsonProperty(required = true)
|
||||
private String parentName;
|
||||
|
||||
@JsonProperty
|
||||
private String title;
|
||||
|
||||
@JsonProperty
|
||||
private String description;
|
||||
|
||||
@JsonProperty
|
||||
private List<CustomAspectPropertiesModel> properties;
|
||||
|
||||
public RestCustomTypeModel()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public RestCustomTypeModel(String name, String parentName)
|
||||
{
|
||||
this.name = name;
|
||||
this.parentName = parentName;
|
||||
}
|
||||
|
||||
public RestCustomTypeModel(String name, String parentName, String title)
|
||||
{
|
||||
this.name = name;
|
||||
this.parentName = parentName;
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RestCustomTypeModel onModel()
|
||||
{
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelAssertion<RestCustomTypeModel> and()
|
||||
{
|
||||
return assertThat();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelAssertion<RestCustomTypeModel> assertThat()
|
||||
{
|
||||
return new ModelAssertion<RestCustomTypeModel>(this);
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getParentName()
|
||||
{
|
||||
return parentName;
|
||||
}
|
||||
|
||||
public void setParentName(String parentName)
|
||||
{
|
||||
this.parentName = parentName;
|
||||
}
|
||||
|
||||
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 List<CustomAspectPropertiesModel> getProperties()
|
||||
{
|
||||
return properties;
|
||||
}
|
||||
|
||||
public void setProperties(List<CustomAspectPropertiesModel> properties)
|
||||
{
|
||||
this.properties = properties;
|
||||
}
|
||||
}
|
@@ -0,0 +1,127 @@
|
||||
/*
|
||||
* Copyright 2020 Alfresco Software, Ltd. All rights reserved.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.alfresco.rest.model;
|
||||
|
||||
import org.alfresco.utility.model.TestModel;
|
||||
|
||||
public class RestIdentityServiceConfigurationModel extends TestModel{
|
||||
|
||||
public RestIdentityServiceConfigurationModel() {
|
||||
|
||||
}
|
||||
|
||||
private String authenticationChain;
|
||||
|
||||
private String authenticationEnabled;
|
||||
|
||||
private String enableBasicAuth;
|
||||
|
||||
private String authServerUrl;
|
||||
|
||||
private String realm;
|
||||
|
||||
private String resource;
|
||||
|
||||
private String publicClient;
|
||||
|
||||
private String sslRequired;
|
||||
|
||||
private String enablePkce;
|
||||
|
||||
private String credentialsSecret;
|
||||
|
||||
private String credentialsProvider;
|
||||
|
||||
public String getAuthenticationChain() {
|
||||
return authenticationChain;
|
||||
}
|
||||
|
||||
public void setAuthenticationChain(String authenticationChain) {
|
||||
this.authenticationChain = authenticationChain;
|
||||
}
|
||||
|
||||
public String getAuthenticationEnabled() {
|
||||
return authenticationEnabled;
|
||||
}
|
||||
|
||||
public void setAuthenticationEnabled(String authenticationEnabled) {
|
||||
this.authenticationEnabled = authenticationEnabled;
|
||||
}
|
||||
|
||||
public String getEnableBasicAuth() {
|
||||
return enableBasicAuth;
|
||||
}
|
||||
|
||||
public void setEnableBasicAuth(String enableBasicAuth) {
|
||||
this.enableBasicAuth = enableBasicAuth;
|
||||
}
|
||||
|
||||
public String getAuthServerUrl() {
|
||||
return authServerUrl;
|
||||
}
|
||||
|
||||
public void setAuthServerUrl(String authServerUrl) {
|
||||
this.authServerUrl = authServerUrl;
|
||||
}
|
||||
|
||||
public String getRealm() {
|
||||
return realm;
|
||||
}
|
||||
|
||||
public void setRealm(String realm) {
|
||||
this.realm = realm;
|
||||
}
|
||||
|
||||
public String getResource() {
|
||||
return resource;
|
||||
}
|
||||
|
||||
public void setResource(String resource) {
|
||||
this.resource = resource;
|
||||
}
|
||||
|
||||
public String getPublicClient() {
|
||||
return publicClient;
|
||||
}
|
||||
|
||||
public void setPublicClient(String publicClient) {
|
||||
this.publicClient = publicClient;
|
||||
}
|
||||
|
||||
public String getSslRequired() {
|
||||
return sslRequired;
|
||||
}
|
||||
|
||||
public void setSslRequired(String sslRequired) {
|
||||
this.sslRequired = sslRequired;
|
||||
}
|
||||
|
||||
public String getEnablePkce() {
|
||||
return enablePkce;
|
||||
}
|
||||
|
||||
public void setEnablePkce(String enablePkce) {
|
||||
this.enablePkce = enablePkce;
|
||||
}
|
||||
|
||||
public String getCredentialsSecret() {
|
||||
return credentialsSecret;
|
||||
}
|
||||
|
||||
public void setCredentialsSecret(String credentialsSecret) {
|
||||
this.credentialsSecret = credentialsSecret;
|
||||
}
|
||||
|
||||
public String getCredentialsProvider() {
|
||||
return credentialsProvider;
|
||||
}
|
||||
|
||||
public void setCredentialsProvider(String credentialsProvider) {
|
||||
this.credentialsProvider = credentialsProvider;
|
||||
}
|
||||
}
|
@@ -20,6 +20,10 @@ public class RestPaginationModel extends TestModel implements IModelAssertion<Re
|
||||
{
|
||||
private int count;
|
||||
private boolean hasMoreItems;
|
||||
/**
|
||||
* {code}totalItems{code} is optional and some endpoints don't include it e.g. GET sites/{siteId}/members
|
||||
* See the section entitled "The list object" in https://ts.alfresco.com/share/page/site/prodman/document-details?nodeRef=workspace://SpacesStore/17eacc65-28e5-40bb-8113-edb8c21d57a5
|
||||
*/
|
||||
private Integer totalItems;
|
||||
private int skipCount;
|
||||
private int maxItems;
|
||||
@@ -44,6 +48,11 @@ public class RestPaginationModel extends TestModel implements IModelAssertion<Re
|
||||
this.hasMoreItems = hasMoreItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the totalItems.
|
||||
*
|
||||
* @return The total number of items, or null if it was not included in the response.
|
||||
*/
|
||||
public Integer getTotalItems()
|
||||
{
|
||||
return totalItems;
|
||||
@@ -75,14 +84,14 @@ public class RestPaginationModel extends TestModel implements IModelAssertion<Re
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelAssertion<RestPaginationModel> assertThat()
|
||||
public ModelAssertion<RestPaginationModel> assertThat()
|
||||
{
|
||||
return new ModelAssertion<RestPaginationModel>(this);
|
||||
}
|
||||
|
||||
return new ModelAssertion<>(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelAssertion<RestPaginationModel> and()
|
||||
public ModelAssertion<RestPaginationModel> and()
|
||||
{
|
||||
return assertThat();
|
||||
}
|
||||
}
|
||||
}
|
@@ -71,6 +71,8 @@ public class RestPersonModel extends TestModel implements IModelAssertion<RestPe
|
||||
private String userStatus;
|
||||
private String password;
|
||||
private Object properties;
|
||||
private String quotaUsed;
|
||||
private String quota;
|
||||
private Map<String, Boolean> capabilities;
|
||||
|
||||
public RestPersonModel()
|
||||
@@ -319,7 +321,25 @@ public class RestPersonModel extends TestModel implements IModelAssertion<RestPe
|
||||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
/**
|
||||
public String getQuotaUsed() {
|
||||
return quotaUsed;
|
||||
}
|
||||
|
||||
|
||||
public void setQuotaUsed(String quotaUsed) {
|
||||
this.quotaUsed = quotaUsed;
|
||||
}
|
||||
|
||||
public String getQuota() {
|
||||
return quota;
|
||||
}
|
||||
|
||||
public void setQuota(String quota) {
|
||||
this.quota = quota;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generate a PersonModel with random values for all existing fields excluding fields specified as ingnoredFields
|
||||
*
|
||||
* @param ignoredFields field to be excluded when generating a random model
|
||||
|
@@ -63,6 +63,8 @@ public class RestSyncServiceConfigModel extends TestModel
|
||||
@JsonProperty(required = true)
|
||||
private RestSyncServiceRepoInfoModel repoInfo;
|
||||
|
||||
private RestIdentityServiceConfigurationModel identityServiceConfig;
|
||||
|
||||
public String getDsyncClientVersionMin()
|
||||
{
|
||||
return dsyncClientVersionMin;
|
||||
@@ -77,5 +79,8 @@ public class RestSyncServiceConfigModel extends TestModel
|
||||
{
|
||||
return repoInfo;
|
||||
}
|
||||
|
||||
|
||||
public RestIdentityServiceConfigurationModel getIdentityServiceConfig() {
|
||||
return identityServiceConfig;
|
||||
}
|
||||
}
|
||||
|
@@ -67,6 +67,8 @@ public class RestSyncServiceModel extends TestModel
|
||||
@JsonProperty(required = true)
|
||||
private RestSyncServiceConfigModel config;
|
||||
|
||||
private RestIdentityServiceConfigurationModel identityServiceConfig;
|
||||
|
||||
public String getId()
|
||||
{
|
||||
return id;
|
||||
@@ -81,5 +83,12 @@ public class RestSyncServiceModel extends TestModel
|
||||
{
|
||||
return config;
|
||||
}
|
||||
|
||||
|
||||
public RestIdentityServiceConfigurationModel getIdentityServiceConfig() {
|
||||
return identityServiceConfig;
|
||||
}
|
||||
|
||||
public void setIdentityServiceConfig(RestIdentityServiceConfigurationModel identityServiceConfig) {
|
||||
this.identityServiceConfig = identityServiceConfig;
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,5 @@
|
||||
package org.alfresco.rest.requests;
|
||||
|
||||
import javax.json.JsonArrayBuilder;
|
||||
|
||||
import org.alfresco.rest.core.JsonBodyGenerator;
|
||||
import org.alfresco.rest.core.RestRequest;
|
||||
import org.alfresco.rest.core.RestWrapper;
|
||||
@@ -18,7 +16,9 @@ public class CustomAspectModelManager extends ModelRequest<CustomAspectModelMana
|
||||
{
|
||||
private CustomContentModel customContentModel;
|
||||
private CustomAspectModel customAspectModel;
|
||||
|
||||
private CustomModelProperties customProperties = new CustomModelProperties(restWrapper);
|
||||
|
||||
|
||||
public CustomAspectModelManager(CustomContentModel customContentModel, CustomAspectModel aspectModel, RestWrapper restWrapper)
|
||||
{
|
||||
super(restWrapper);
|
||||
@@ -29,41 +29,58 @@ public class CustomAspectModelManager extends ModelRequest<CustomAspectModelMana
|
||||
public RestCustomAspectModel getAspect()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "cmm/{modelName}/aspects/{aspectName}?{parameters}",
|
||||
this.customContentModel.getName(), this.customAspectModel.getName(), restWrapper.getParameters());
|
||||
this.customContentModel.getName(), this.customAspectModel.getName(), restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestCustomAspectModel.class, request);
|
||||
}
|
||||
|
||||
public void addProperty(CustomAspectPropertiesModel propertyModel)
|
||||
{
|
||||
JsonArrayBuilder array = JsonBodyGenerator.defineJSONArray();
|
||||
array.add(JsonBodyGenerator.defineJSON()
|
||||
.add("name", propertyModel.getName())
|
||||
.add("title", propertyModel.getTitle())
|
||||
.add("description", propertyModel.getDescription())
|
||||
.add("dataType", propertyModel.getDataType())
|
||||
.add("multiValued", propertyModel.isMultiValued())
|
||||
.add("mandatory", propertyModel.isMandatory())
|
||||
.add("mandatoryEnforced", propertyModel.isMandatoryEnforced()));
|
||||
|
||||
String body = JsonBodyGenerator.defineJSON().add("name", this.customAspectModel.getName()).add("properties", array).build().toString();
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.PUT, body, "cmm/{modelName}/aspects/{aspectName}?select=props",
|
||||
this.customContentModel.getName(), this.customAspectModel.getName());
|
||||
restWrapper.processEmptyModel(request);
|
||||
customProperties.addProperty(propertyModel, this.customContentModel, true,
|
||||
this.customAspectModel.getName(), false, null);
|
||||
}
|
||||
|
||||
|
||||
public void addPropertyWithMinMaxValueConstraint(CustomAspectPropertiesModel propertyModel, int minValue, int maxValue)
|
||||
{
|
||||
customProperties.addProperty(propertyModel, this.customContentModel, true, this.customAspectModel.getName(),
|
||||
true, customProperties.createMinMaxValueConstraintArray(minValue, maxValue));
|
||||
}
|
||||
|
||||
public void addPropertyWithMinMaxLengthConstraint(CustomAspectPropertiesModel propertyModel, int minLength, int maxLength)
|
||||
{
|
||||
customProperties.addProperty(propertyModel, this.customContentModel, true, this.customAspectModel.getName(),
|
||||
true, customProperties.createMinMaxLengthConstraint(minLength, maxLength));
|
||||
}
|
||||
|
||||
public void addPropertyWithListOfValues(CustomAspectPropertiesModel propertyModel, boolean sorted, String... listOfValues)
|
||||
{
|
||||
customProperties.addProperty(propertyModel, this.customContentModel, true, this.customAspectModel.getName(),
|
||||
true, customProperties.createListOfValuesConstraint(sorted, listOfValues));
|
||||
}
|
||||
|
||||
public void addPropertyWithRegularExpression(CustomAspectPropertiesModel propertyModel, String regex)
|
||||
{
|
||||
customProperties.addProperty(propertyModel, this.customContentModel, true, this.customAspectModel.getName(),
|
||||
true, customProperties.createRegexConstraint(regex));
|
||||
}
|
||||
|
||||
public void deleteAspectProperty(CustomAspectPropertiesModel propertyModel)
|
||||
{
|
||||
String body = JsonBodyGenerator.defineJSON()
|
||||
.add("name", this.customAspectModel.getName()).build().toString();
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.PUT, body, "cmm/{modelName}/aspects/{aspectName}?select=props&delete={propertyName}",
|
||||
this.customContentModel.getName(), this.customAspectModel.getName(), propertyModel.getName());
|
||||
.add("name", this.customAspectModel.getName()).build().toString();
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.PUT, body,
|
||||
"cmm/{modelName}/aspects/{aspectName}?select=props&delete={propertyName}",
|
||||
this.customContentModel.getName(),
|
||||
this.customAspectModel.getName(),
|
||||
propertyModel.getName());
|
||||
restWrapper.processEmptyModel(request);
|
||||
}
|
||||
|
||||
public void deleteAspect()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.DELETE, "cmm/{modelName}/aspects/{aspectName}",
|
||||
this.customContentModel.getName(), this.customAspectModel.getName());
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.DELETE,
|
||||
"cmm/{modelName}/aspects/{aspectName}",
|
||||
this.customContentModel.getName(),
|
||||
this.customAspectModel.getName());
|
||||
restWrapper.processEmptyModel(request);
|
||||
}
|
||||
}
|
||||
|
@@ -3,10 +3,19 @@ package org.alfresco.rest.requests;
|
||||
import org.alfresco.rest.core.JsonBodyGenerator;
|
||||
import org.alfresco.rest.core.RestRequest;
|
||||
import org.alfresco.rest.core.RestWrapper;
|
||||
import org.alfresco.rest.model.RestCustomAspectModel;
|
||||
import org.alfresco.rest.model.RestCustomModel;
|
||||
import org.alfresco.rest.model.RestCustomTypeModel;
|
||||
import org.alfresco.rest.model.RestGroupsModelsCollection;
|
||||
import org.alfresco.utility.model.CustomAspectModel;
|
||||
import org.alfresco.utility.model.CustomAspectPropertiesModel;
|
||||
import org.alfresco.utility.model.CustomContentModel;
|
||||
import org.springframework.http.HttpMethod;
|
||||
|
||||
import javax.json.Json;
|
||||
import javax.json.JsonArrayBuilder;
|
||||
import javax.json.JsonObject;
|
||||
|
||||
/**
|
||||
* @author Bogdan Bocancea
|
||||
*/
|
||||
@@ -14,12 +23,30 @@ public class CustomModelManager extends ModelRequest<CustomModelManager>
|
||||
{
|
||||
private CustomContentModel customContentModel;
|
||||
|
||||
public CustomModelManager(RestWrapper restWrapper)
|
||||
{
|
||||
super(restWrapper);
|
||||
}
|
||||
|
||||
public CustomModelManager(CustomContentModel customContentModel, RestWrapper restWrapper)
|
||||
{
|
||||
super(restWrapper);
|
||||
this.customContentModel = customContentModel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new custom model
|
||||
*
|
||||
* @param customContentModel
|
||||
* @return {@link RestCustomModel}
|
||||
*/
|
||||
public RestCustomModel createCustomModel(CustomContentModel customContentModel)
|
||||
{
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, customContentModel.toJson(),
|
||||
"cmm?{parameters}", restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestCustomModel.class, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve one model using GET call on "cmm/{modelName}"
|
||||
*
|
||||
@@ -51,4 +78,18 @@ public class CustomModelManager extends ModelRequest<CustomModelManager>
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.DELETE, "cmm/{modelName}", this.customContentModel.getName());
|
||||
restWrapper.processEmptyModel(request);
|
||||
}
|
||||
|
||||
public RestCustomAspectModel createAspect(CustomAspectModel aspectModel)
|
||||
{
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, aspectModel.toJson(),
|
||||
"cmm/{modelName}/aspects?{parameters}", this.customContentModel.getName(), restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestCustomAspectModel.class, request);
|
||||
}
|
||||
|
||||
public RestCustomTypeModel createCustomType(RestCustomTypeModel customType)
|
||||
{
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, customType.toJson(),
|
||||
"cmm/{modelName}/types?{parameters}", this.customContentModel.getName(), restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestCustomTypeModel.class, request);
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,164 @@
|
||||
package org.alfresco.rest.requests;
|
||||
|
||||
import org.alfresco.rest.core.JsonBodyGenerator;
|
||||
import org.alfresco.rest.core.RestRequest;
|
||||
import org.alfresco.rest.core.RestWrapper;
|
||||
import org.alfresco.utility.model.CustomAspectPropertiesModel;
|
||||
import org.alfresco.utility.model.CustomContentModel;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.http.HttpMethod;
|
||||
|
||||
import javax.json.JsonArrayBuilder;
|
||||
import javax.json.JsonObjectBuilder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author Bogdan Bocancea
|
||||
*/
|
||||
public class CustomModelProperties extends ModelRequest<CustomModelProperties>
|
||||
{
|
||||
public CustomModelProperties(RestWrapper restWrapper)
|
||||
{
|
||||
super(restWrapper);
|
||||
}
|
||||
|
||||
public void addProperty(CustomAspectPropertiesModel propertyModel,
|
||||
CustomContentModel customContentModel,
|
||||
boolean isAspect,
|
||||
String aspectOrTypeName,
|
||||
boolean hasConstraints,
|
||||
JsonArrayBuilder constraintsArray)
|
||||
{
|
||||
JsonArrayBuilder array;
|
||||
if(hasConstraints)
|
||||
{
|
||||
array = getPropertiesArray(propertyModel, true, constraintsArray);
|
||||
}
|
||||
else
|
||||
{
|
||||
array = getPropertiesArray(propertyModel, false, null);
|
||||
}
|
||||
|
||||
String body = JsonBodyGenerator.defineJSON()
|
||||
.add("name", aspectOrTypeName)
|
||||
.add("properties", array).build().toString();
|
||||
String urlPath;
|
||||
if(isAspect)
|
||||
{
|
||||
urlPath = "cmm/{modelName}/aspects/{aspectName}?select=props";
|
||||
}
|
||||
else
|
||||
{
|
||||
urlPath = "cmm/{modelName}/types/{typeName}?select=props";
|
||||
}
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.PUT, body, urlPath,
|
||||
customContentModel.getName(), aspectOrTypeName);
|
||||
restWrapper.processEmptyModel(request);
|
||||
}
|
||||
|
||||
private JsonArrayBuilder getPropertiesArray(CustomAspectPropertiesModel propertyModel, boolean hasConstraints, JsonArrayBuilder constraintsArray)
|
||||
{
|
||||
JsonArrayBuilder array = JsonBodyGenerator.defineJSONArray();;
|
||||
if(hasConstraints)
|
||||
{
|
||||
array.add(JsonBodyGenerator.defineJSON()
|
||||
.add("name", propertyModel.getName())
|
||||
.add("title", propertyModel.getTitle())
|
||||
.add("description", propertyModel.getDescription())
|
||||
.add("dataType", propertyModel.getDataType())
|
||||
.add("multiValued", propertyModel.isMultiValued())
|
||||
.add("mandatory", propertyModel.isMandatory())
|
||||
.add("mandatoryEnforced", propertyModel.isMandatoryEnforced())
|
||||
.add("constraints", constraintsArray));
|
||||
}
|
||||
else
|
||||
{
|
||||
array.add(JsonBodyGenerator.defineJSON()
|
||||
.add("name", propertyModel.getName())
|
||||
.add("title", propertyModel.getTitle())
|
||||
.add("description", propertyModel.getDescription())
|
||||
.add("dataType", propertyModel.getDataType())
|
||||
.add("multiValued", propertyModel.isMultiValued())
|
||||
.add("mandatory", propertyModel.isMandatory())
|
||||
.add("mandatoryEnforced", propertyModel.isMandatoryEnforced()));
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
public JsonArrayBuilder createMinMaxValueConstraintArray(int minValue, int maxValue)
|
||||
{
|
||||
JsonArrayBuilder constraintsArray = JsonBodyGenerator.defineJSONArray();
|
||||
JsonObjectBuilder param1 = JsonBodyGenerator.defineJSON()
|
||||
.add("name", "minValue")
|
||||
.add("simpleValue", Integer.valueOf(minValue));
|
||||
JsonObjectBuilder param2 = JsonBodyGenerator.defineJSON()
|
||||
.add("name", "maxValue")
|
||||
.add("simpleValue", Integer.valueOf(maxValue));
|
||||
JsonArrayBuilder parameters = JsonBodyGenerator.defineJSONArray();
|
||||
parameters.add(0, param1).add(1, param2);
|
||||
constraintsArray.add(JsonBodyGenerator.defineJSON()
|
||||
.add("name", "MINMAX_" + UUID.randomUUID())
|
||||
.add("type", "MINMAX")
|
||||
.add("parameters", parameters));
|
||||
return constraintsArray;
|
||||
}
|
||||
|
||||
public JsonArrayBuilder createMinMaxLengthConstraint(int minLength, int maxLength)
|
||||
{
|
||||
JsonArrayBuilder constraintsArray = JsonBodyGenerator.defineJSONArray();
|
||||
JsonObjectBuilder param1 = JsonBodyGenerator.defineJSON()
|
||||
.add("name", "minLength")
|
||||
.add("simpleValue", Integer.valueOf(minLength));
|
||||
JsonObjectBuilder param2 = JsonBodyGenerator.defineJSON()
|
||||
.add("name", "maxLength")
|
||||
.add("simpleValue", Integer.valueOf(maxLength));
|
||||
JsonArrayBuilder parameters = JsonBodyGenerator.defineJSONArray();
|
||||
parameters.add(0, param1).add(1, param2);
|
||||
constraintsArray.add(JsonBodyGenerator.defineJSON()
|
||||
.add("name", "LENGTH_" + UUID.randomUUID())
|
||||
.add("type", "LENGTH")
|
||||
.add("parameters", parameters));
|
||||
return constraintsArray;
|
||||
}
|
||||
|
||||
public JsonArrayBuilder createListOfValuesConstraint(boolean sorted, String... listOfValues)
|
||||
{
|
||||
JsonArrayBuilder valuesArray = JsonBodyGenerator.defineJSONArray();
|
||||
Arrays.stream(listOfValues).forEach(valuesArray::add);
|
||||
JsonArrayBuilder constraintsArray = JsonBodyGenerator.defineJSONArray();
|
||||
JsonObjectBuilder param1 = JsonBodyGenerator.defineJSON()
|
||||
.add("name", "allowedValues")
|
||||
.add("listValue", valuesArray);
|
||||
JsonObjectBuilder param2 = JsonBodyGenerator.defineJSON()
|
||||
.add("name", "sorted")
|
||||
.add("simpleValue", Boolean.valueOf(sorted));
|
||||
JsonArrayBuilder parameters = JsonBodyGenerator.defineJSONArray();
|
||||
parameters.add(0, param1).add(1, param2);
|
||||
constraintsArray.add(JsonBodyGenerator.defineJSON()
|
||||
.add("name", "LIST_" + UUID.randomUUID())
|
||||
.add("type", "LIST")
|
||||
.add("parameters", parameters));
|
||||
return constraintsArray;
|
||||
}
|
||||
|
||||
public JsonArrayBuilder createRegexConstraint(String regex)
|
||||
{
|
||||
JsonArrayBuilder constraintsArray = JsonBodyGenerator.defineJSONArray();
|
||||
JsonObjectBuilder param1 = JsonBodyGenerator.defineJSON()
|
||||
.add("name", "expression")
|
||||
.add("simpleValue", regex);
|
||||
JsonObjectBuilder param2 = JsonBodyGenerator.defineJSON()
|
||||
.add("name", "requiresMatch")
|
||||
.add("simpleValue", true);
|
||||
JsonArrayBuilder parameters = JsonBodyGenerator.defineJSONArray();
|
||||
parameters.add(0, param1).add(1, param2);
|
||||
constraintsArray.add(JsonBodyGenerator.defineJSON()
|
||||
.add("name", "REGEX_" + UUID.randomUUID())
|
||||
.add("type", "REGEX")
|
||||
.add("parameters", parameters));
|
||||
return constraintsArray;
|
||||
}
|
||||
}
|
@@ -0,0 +1,65 @@
|
||||
package org.alfresco.rest.requests;
|
||||
|
||||
import org.alfresco.rest.core.RestRequest;
|
||||
import org.alfresco.rest.core.RestWrapper;
|
||||
import org.alfresco.rest.model.RestCustomTypeModel;
|
||||
import org.alfresco.utility.model.CustomAspectPropertiesModel;
|
||||
import org.alfresco.utility.model.CustomContentModel;
|
||||
import org.springframework.http.HttpMethod;
|
||||
|
||||
/**
|
||||
* @author Bogdan Bocancea
|
||||
*/
|
||||
public class CustomTypeManager extends ModelRequest<CustomTypeManager>
|
||||
{
|
||||
private CustomContentModel customContentModel;
|
||||
private RestCustomTypeModel customTypeModel;
|
||||
private CustomModelProperties customProperties = new CustomModelProperties(restWrapper);
|
||||
|
||||
public CustomTypeManager(CustomContentModel customContentModel, RestCustomTypeModel customTypeModel, RestWrapper restWrapper)
|
||||
{
|
||||
super(restWrapper);
|
||||
this.customContentModel = customContentModel;
|
||||
this.customTypeModel = customTypeModel;
|
||||
}
|
||||
|
||||
public RestCustomTypeModel getCustomType()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "cmm/{modelName}/types/{typeName}?{parameters}",
|
||||
this.customContentModel.getName(), this.customTypeModel.getName(), restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestCustomTypeModel.class, request);
|
||||
}
|
||||
|
||||
public void addProperty(CustomAspectPropertiesModel propertyModel)
|
||||
{
|
||||
customProperties.addProperty(propertyModel, this.customContentModel, false,
|
||||
this.customTypeModel.getName(), false, null);
|
||||
}
|
||||
|
||||
public void addPropertyWithMinMaxValueConstraint(CustomAspectPropertiesModel propertyModel, int minValue, int maxValue)
|
||||
{
|
||||
customProperties.addProperty(propertyModel, this.customContentModel, false, this.customTypeModel.getName(),
|
||||
true, customProperties.createMinMaxValueConstraintArray(minValue, maxValue));
|
||||
}
|
||||
|
||||
public void addPropertyWithMinMaxLengthConstraint(CustomAspectPropertiesModel propertyModel, int minLength, int maxLength)
|
||||
{
|
||||
customProperties.addProperty(propertyModel, this.customContentModel, false, this.customTypeModel.getName(),
|
||||
true, customProperties.createMinMaxLengthConstraint(minLength, maxLength));
|
||||
}
|
||||
|
||||
public void addPropertyWithListOfValues(CustomAspectPropertiesModel propertyModel, boolean sorted, String... listOfValues)
|
||||
{
|
||||
customProperties.addProperty(propertyModel, this.customContentModel, false, this.customTypeModel.getName(),
|
||||
true, customProperties.createListOfValuesConstraint(sorted, listOfValues));
|
||||
}
|
||||
|
||||
public void deleteCustomType()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.DELETE,
|
||||
"cmm/{modelName}/types/{typeName}",
|
||||
this.customContentModel.getName(),
|
||||
this.customTypeModel.getName());
|
||||
restWrapper.processEmptyModel(request);
|
||||
}
|
||||
}
|
@@ -382,7 +382,7 @@ public class Node extends ModelRequest<Node>
|
||||
public void createNodeRenditionIfNotExists(String renditionId) throws Exception
|
||||
{
|
||||
getNodeRendition(renditionId);
|
||||
if (HttpStatus.OK.toString().equals(restWrapper.getStatusCode()))
|
||||
if (Integer.valueOf(restWrapper.getStatusCode()).equals(HttpStatus.OK.value()))
|
||||
{
|
||||
String postBody = JsonBodyGenerator.keyValueJson("id", renditionId);
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, postBody, "nodes/{nodeId}/renditions", repoModel.getNodeRef());
|
||||
@@ -415,7 +415,7 @@ public class Node extends ModelRequest<Node>
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "nodes/{nodeId}/renditions/{renditionId}",repoModel.getNodeRef(), renditionId);
|
||||
RestRenditionInfoModel renditions = restWrapper.processModel(RestRenditionInfoModel.class, request);
|
||||
int retry = 0;
|
||||
if (restWrapper.getStatusCode().equals(HttpStatus.OK.toString()))
|
||||
if (Integer.valueOf(restWrapper.getStatusCode()).equals(HttpStatus.OK.value()))
|
||||
{
|
||||
while (renditions.getStatus().equals("NOT_CREATED") && retry < Utility.retryCountSeconds - 8)
|
||||
{
|
||||
@@ -442,7 +442,7 @@ public class Node extends ModelRequest<Node>
|
||||
renditionId);
|
||||
RestResponse response = restWrapper.process(request);
|
||||
int retry = 0;
|
||||
while (response.getStatusCode().equals(HttpStatus.NOT_FOUND.toString()) && retry < Utility.retryCountSeconds)
|
||||
while (Integer.valueOf(response.getStatusCode()).equals(HttpStatus.NOT_FOUND.value()) && retry < Utility.retryCountSeconds)
|
||||
{
|
||||
Utility.waitToLoopTime(1);
|
||||
response = restWrapper.process(request);
|
||||
|
@@ -81,7 +81,7 @@ public class People extends ModelRequest<People>
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "people/{personId}/activities?{parameters}", this.person.getUsername(), restWrapper.getParameters());
|
||||
RestActivityModelsCollection activityCollection = restWrapper.processModels(RestActivityModelsCollection.class, request);
|
||||
int retry = 0;
|
||||
if (restWrapper.getStatusCode().equals(HttpStatus.OK.toString()))
|
||||
if (Integer.valueOf(restWrapper.getStatusCode()).equals(HttpStatus.OK.value()))
|
||||
{
|
||||
while ((activityCollection.isEmpty() || activityCollection.getPagination().getCount() != expectedNoOfEntries) && retry < Utility.retryCountSeconds + 20)
|
||||
{
|
||||
|
@@ -35,11 +35,10 @@ public class Site extends ModelRequest<Site>
|
||||
/**
|
||||
* Retrieve one site using GET call on "sites/{siteId}"
|
||||
*
|
||||
* @param siteId
|
||||
* @return
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestSiteModel getSite() throws Exception
|
||||
public RestSiteModel getSite()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "sites/{siteId}?{parameters}", this.site.getId(), restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestSiteModel.class, request);
|
||||
@@ -48,11 +47,10 @@ public class Site extends ModelRequest<Site>
|
||||
/**
|
||||
* Retrieve one site using GET call on "sites/{siteId}" along with relations parameter
|
||||
*
|
||||
* @param siteId
|
||||
* @return
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public List<Object> getSiteWithRelations() throws Exception
|
||||
public List<Object> getSiteWithRelations()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "sites/{siteId}?{parameters}", this.site.getId(), restWrapper.getParameters());
|
||||
return restWrapper.processRelationsJson(request);
|
||||
@@ -64,7 +62,7 @@ public class Site extends ModelRequest<Site>
|
||||
* @return
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestSiteModelsCollection getSites() throws Exception
|
||||
public RestSiteModelsCollection getSites()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "sites?{parameters}", restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestSiteModelsCollection.class, request);
|
||||
@@ -76,7 +74,7 @@ public class Site extends ModelRequest<Site>
|
||||
* @return
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public List<List<Object>> getSitesWithRelations() throws Exception
|
||||
public List<List<Object>> getSitesWithRelations()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "sites?{parameters}", restWrapper.getParameters());
|
||||
return restWrapper.processSitesRelationsJson(request);
|
||||
@@ -87,10 +85,9 @@ public class Site extends ModelRequest<Site>
|
||||
*
|
||||
* @param person {@link UserModel}
|
||||
* @return
|
||||
* @throws Exception
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestSiteMemberModel addPerson(UserModel person) throws Exception
|
||||
public RestSiteMemberModel addPerson(UserModel person)
|
||||
{
|
||||
String siteMemberBody = JsonBodyGenerator.siteMember(person);
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, siteMemberBody, "sites/{siteId}/members?{parameters}", site.getId(), restWrapper.getParameters());
|
||||
@@ -103,7 +100,7 @@ public class Site extends ModelRequest<Site>
|
||||
* @return
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestSiteMemberModelsCollection getSiteMembers() throws Exception
|
||||
public RestSiteMemberModelsCollection getSiteMembers()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "sites/{siteId}/members?{parameters}", site.getId(), restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestSiteMemberModelsCollection.class, request);
|
||||
@@ -112,12 +109,11 @@ public class Site extends ModelRequest<Site>
|
||||
/**
|
||||
* Retrieve specific member of a site using GET call on "sites/{siteId}/members/{personId}"
|
||||
*
|
||||
* @param siteId
|
||||
* @param personid
|
||||
* @param user A model containing the username to look for.
|
||||
* @return
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestSiteMemberModel getSiteMember(UserModel user) throws Exception
|
||||
public RestSiteMemberModel getSiteMember(UserModel user)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "sites/{siteId}/members/{personId}?{parameters}", site.getId(), user.getUsername(), restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestSiteMemberModel.class, request);
|
||||
@@ -129,7 +125,7 @@ public class Site extends ModelRequest<Site>
|
||||
* @return
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestSiteMemberModel updateSiteMember(UserModel siteMember) throws Exception
|
||||
public RestSiteMemberModel updateSiteMember(UserModel siteMember)
|
||||
{
|
||||
String json = JsonBodyGenerator.keyValueJson("role", siteMember.getUserRole().toString());
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.PUT, json, "sites/{siteId}/members/{personId}", site.getId(), siteMember.getUsername());
|
||||
@@ -139,9 +135,8 @@ public class Site extends ModelRequest<Site>
|
||||
/**
|
||||
* Delete site member with DELETE call on "sites/{siteId}/members/{personId}"
|
||||
* @param person
|
||||
* @throws Exception
|
||||
*/
|
||||
public void deleteSiteMember(UserModel person) throws Exception
|
||||
public void deleteSiteMember(UserModel person)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.DELETE, "sites/{siteId}/members/{personId}", site.getId(), person.getUsername());
|
||||
restWrapper.processEmptyModel(request);
|
||||
@@ -153,7 +148,7 @@ public class Site extends ModelRequest<Site>
|
||||
* @return
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestSiteContainerModelsCollection getSiteContainers() throws Exception
|
||||
public RestSiteContainerModelsCollection getSiteContainers()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "sites/{siteId}/containers?{parameters}", site.getId(), restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestSiteContainerModelsCollection.class, request);
|
||||
@@ -162,12 +157,11 @@ public class Site extends ModelRequest<Site>
|
||||
/**
|
||||
* Retrieve specific container of a site using GET call on "sites/{siteId}/containers/{containerId}"
|
||||
*
|
||||
* @param siteId
|
||||
* @param folderId
|
||||
* @param container A model containing the folderId to look for.
|
||||
* @return
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestSiteContainerModel getSiteContainer(RestSiteContainerModel container) throws Exception
|
||||
public RestSiteContainerModel getSiteContainer(RestSiteContainerModel container)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "sites/{siteId}/containers/{containerId}?{parameters}", site.getId(), container.getFolderId(), restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestSiteContainerModel.class, request);
|
||||
@@ -176,12 +170,11 @@ public class Site extends ModelRequest<Site>
|
||||
/**
|
||||
* Retrieve specific container of a site using GET call on "sites/{siteId}/containers/{containerId}"
|
||||
*
|
||||
* @param siteId
|
||||
* @param folderId
|
||||
* @param containerFolder The id of the container to look for.
|
||||
* @return
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestSiteContainerModel getSiteContainer(String containerFolder) throws Exception
|
||||
public RestSiteContainerModel getSiteContainer(String containerFolder)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "sites/{siteId}/containers/{containerId}?{parameters}", site.getId(), containerFolder, restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestSiteContainerModel.class, request);
|
||||
@@ -190,7 +183,6 @@ public class Site extends ModelRequest<Site>
|
||||
/**
|
||||
* Create a collaboration site
|
||||
*
|
||||
* @param site information on the site to create
|
||||
* @return the properties of the created site
|
||||
* @throws Exception
|
||||
*/
|
||||
@@ -200,13 +192,44 @@ public class Site extends ModelRequest<Site>
|
||||
return restWrapper.processModel(RestSiteModel.class, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a site: Site title, description, visibility can be updated
|
||||
* Body:
|
||||
* {
|
||||
* "title": "string",
|
||||
* "description": "string",
|
||||
* "visibility": "PRIVATE"
|
||||
* }
|
||||
*
|
||||
* Response:
|
||||
* {
|
||||
* "entry": {
|
||||
* "id": "string",
|
||||
* "guid": "string",
|
||||
* "title": "string",
|
||||
* "description": "string",
|
||||
* "visibility": "PRIVATE",
|
||||
* "preset": "string",
|
||||
* "role": "SiteConsumer"
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* @return the properties of an updated site
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestSiteModel updateSite(SiteModel site) throws Exception
|
||||
{
|
||||
String siteBody = JsonBodyGenerator.updateSiteRequest(site);
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.PUT, siteBody, "sites/{siteId}", site.getId());
|
||||
return restWrapper.processModel(RestSiteModel.class, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get site membership requests by using GET /site-membership-requests
|
||||
*
|
||||
* @return site memberships
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestSitePersonMembershipRequestModelsCollection getSiteMemberships() throws Exception
|
||||
public RestSitePersonMembershipRequestModelsCollection getSiteMemberships()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "site-membership-requests?{parameters}", restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestSitePersonMembershipRequestModelsCollection.class, request);
|
||||
@@ -216,9 +239,8 @@ public class Site extends ModelRequest<Site>
|
||||
* Approve a site membership request by using POST call on /sites/{siteId}/site-membership-requests/{inviteeId}/approve
|
||||
*
|
||||
* @param siteMember
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestResponse approveSiteMembership(UserModel siteMember) throws Exception
|
||||
public RestResponse approveSiteMembership(UserModel siteMember)
|
||||
{
|
||||
String json = JsonBodyGenerator.keyValueJson("role", siteMember.getUserRole().toString());
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, json, "sites/{siteId}/site-membership-requests/{inviteeId}/approve", site.getId(), siteMember.getUsername());
|
||||
@@ -229,9 +251,8 @@ public class Site extends ModelRequest<Site>
|
||||
* Reject a site membership request by using POST call /sites/{siteId}/site-membership-requests/{inviteeId}/reject
|
||||
*
|
||||
* @param siteMember
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestResponse rejectSiteMembership(UserModel siteMember) throws Exception
|
||||
public RestResponse rejectSiteMembership(UserModel siteMember)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.POST, "sites/{siteId}/site-membership-requests/{inviteeId}/reject", site.getId(), siteMember.getUsername());
|
||||
return restWrapper.process(request);
|
||||
|
@@ -43,7 +43,7 @@ public class Tenant extends ModelRequest<Tenant>
|
||||
.contentType(ContentType.JSON);
|
||||
Response returnedResponse = request.contentType(ContentType.JSON).body(json)
|
||||
.post(String.format("%s/%s", restProperties.envProperty().getFullServerUrl(), "alfresco/service/api/tenants")).andReturn();
|
||||
if (!String.valueOf(returnedResponse.getStatusCode()).equals(HttpStatus.OK.toString()))
|
||||
if (!Integer.valueOf(returnedResponse.getStatusCode()).equals(HttpStatus.OK.value()))
|
||||
{
|
||||
throw new Exception(String.format("Tenant is not created: %s", returnedResponse.asString()));
|
||||
}
|
||||
|
@@ -21,9 +21,8 @@ public class Trashcan extends ModelRequest<Trashcan>
|
||||
* GET on deleted-nodes
|
||||
*
|
||||
* @return RestNodeModelsCollection
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestNodeModelsCollection findDeletedNodes() throws Exception
|
||||
public RestNodeModelsCollection findDeletedNodes()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "deleted-nodes?{parameters}", restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestNodeModelsCollection.class, request);
|
||||
@@ -34,9 +33,8 @@ public class Trashcan extends ModelRequest<Trashcan>
|
||||
*
|
||||
* @param repoModel
|
||||
* @return RestNodeModel
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestNodeModel findDeletedNode(RepoTestModel repoModel) throws Exception
|
||||
public RestNodeModel findDeletedNode(RepoTestModel repoModel)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "deleted-nodes/{nodeId}?{parameters}", repoModel.getNodeRefWithoutVersion(), restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestNodeModel.class, request);
|
||||
@@ -47,9 +45,8 @@ public class Trashcan extends ModelRequest<Trashcan>
|
||||
*
|
||||
* @param repoModel
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public void deleteNodeFromTrashcan(RepoTestModel repoModel) throws Exception
|
||||
public void deleteNodeFromTrashcan(RepoTestModel repoModel)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.DELETE, "deleted-nodes/{nodeId}", repoModel.getNodeRefWithoutVersion());
|
||||
restWrapper.processEmptyModel(request);
|
||||
@@ -60,9 +57,8 @@ public class Trashcan extends ModelRequest<Trashcan>
|
||||
*
|
||||
* @param repoModel
|
||||
* @return RestNodeModel
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestNodeModel restoreNodeFromTrashcan(RepoTestModel repoModel) throws Exception
|
||||
public RestNodeModel restoreNodeFromTrashcan(RepoTestModel repoModel)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.POST, "deleted-nodes/{nodeId}/restore?{parameters}", repoModel.getNodeRefWithoutVersion(), restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestNodeModel.class, request);
|
||||
@@ -73,9 +69,8 @@ public class Trashcan extends ModelRequest<Trashcan>
|
||||
*
|
||||
* @param repoModel
|
||||
* @return RestResponse
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestResponse getDeletedNodeContent(RepoTestModel repoModel) throws Exception
|
||||
public RestResponse getDeletedNodeContent(RepoTestModel repoModel)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "deleted-nodes/{nodeId}/content?{parameters}", repoModel.getNodeRefWithoutVersion(), restWrapper.getParameters());
|
||||
return restWrapper.process(request);
|
||||
@@ -86,9 +81,8 @@ public class Trashcan extends ModelRequest<Trashcan>
|
||||
*
|
||||
* @param repoModel
|
||||
* @return RestRenditionInfoModelCollection
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestRenditionInfoModelCollection getDeletedNodeRenditions(RepoTestModel repoModel) throws Exception
|
||||
public RestRenditionInfoModelCollection getDeletedNodeRenditions(RepoTestModel repoModel)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "deleted-nodes/{nodeId}/renditions?{parameters}", repoModel.getNodeRefWithoutVersion(), restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestRenditionInfoModelCollection.class, request);
|
||||
@@ -100,9 +94,8 @@ public class Trashcan extends ModelRequest<Trashcan>
|
||||
* @param repoModel
|
||||
* @param renditionId
|
||||
* @return RestRenditionInfoModel
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestRenditionInfoModel getDeletedNodeRendition(RepoTestModel repoModel, String renditionId) throws Exception
|
||||
public RestRenditionInfoModel getDeletedNodeRendition(RepoTestModel repoModel, String renditionId)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "deleted-nodes/{nodeId}/renditions/{renditionId}?{parameters}", repoModel.getNodeRefWithoutVersion(), renditionId, restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestRenditionInfoModel.class, request);
|
||||
@@ -114,9 +107,8 @@ public class Trashcan extends ModelRequest<Trashcan>
|
||||
* @param repoModel
|
||||
* @param renditionId
|
||||
* @return RestResponse
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestResponse getDeletedNodeRenditionContent(RepoTestModel repoModel, String renditionId) throws Exception
|
||||
public RestResponse getDeletedNodeRenditionContent(RepoTestModel repoModel, String renditionId)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "deleted-nodes/{nodeId}/renditions/{renditionId}/content?{parameters}", repoModel.getNodeRefWithoutVersion(), renditionId, restWrapper.getParameters());
|
||||
return restWrapper.process(request);
|
||||
|
@@ -1,10 +1,12 @@
|
||||
package org.alfresco.rest.requests.privateAPI;
|
||||
|
||||
import org.alfresco.rest.core.RestWrapper;
|
||||
import org.alfresco.rest.model.RestCustomTypeModel;
|
||||
import org.alfresco.rest.model.RestSubscriberModel;
|
||||
import org.alfresco.rest.model.RestSyncNodeSubscriptionModel;
|
||||
import org.alfresco.rest.requests.CustomAspectModelManager;
|
||||
import org.alfresco.rest.requests.CustomModelManager;
|
||||
import org.alfresco.rest.requests.CustomTypeManager;
|
||||
import org.alfresco.rest.requests.ModelRequest;
|
||||
import org.alfresco.rest.requests.syncServiceAPI.Healthcheck;
|
||||
import org.alfresco.rest.requests.syncServiceAPI.Subscribers;
|
||||
@@ -38,6 +40,11 @@ public class RestPrivateAPI extends ModelRequest<RestPrivateAPI>
|
||||
return new CustomModelManager(customContentModel, restWrapper);
|
||||
}
|
||||
|
||||
public CustomModelManager usingCustomModel()
|
||||
{
|
||||
return new CustomModelManager(restWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides DSL on all REST calls under <code>cmm/{modelName}/aspects/{aspectName}...</code> API path
|
||||
*
|
||||
@@ -50,6 +57,18 @@ public class RestPrivateAPI extends ModelRequest<RestPrivateAPI>
|
||||
return new CustomAspectModelManager(customContentModel, aspectModel, restWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides DSL on all REST calls under <code>cmm/{modelName}/types/{typeName}...</code> API path
|
||||
*
|
||||
* @param customContentModel {@link CustomContentModel}
|
||||
* @param customType {@link RestCustomTypeModel}
|
||||
* @return {@link CustomTypeManager}
|
||||
*/
|
||||
public CustomTypeManager usingCustomType(CustomContentModel customContentModel, RestCustomTypeModel customType)
|
||||
{
|
||||
return new CustomTypeManager(customContentModel, customType, restWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides DSL on all REST calls under <code>subscribers/</code> API path
|
||||
*
|
||||
|
@@ -18,14 +18,13 @@
|
||||
*/
|
||||
package org.alfresco.rest.requests.search;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import org.alfresco.rest.core.RestRequest;
|
||||
import org.alfresco.rest.core.RestWrapper;
|
||||
import org.alfresco.rest.requests.ModelRequest;
|
||||
import org.alfresco.rest.search.SearchRequest;
|
||||
import org.alfresco.rest.search.SearchResponse;
|
||||
import org.springframework.http.HttpMethod;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
/**
|
||||
* Wrapper for Search API.
|
||||
* @author Michael Suzuki
|
||||
@@ -36,11 +35,12 @@ public class SearchAPI extends ModelRequest<SearchAPI>
|
||||
public SearchAPI(RestWrapper restWrapper)
|
||||
{
|
||||
super(restWrapper);
|
||||
restWrapper.configureAlfrescoEndpoint();
|
||||
RestAssured.basePath = "alfresco/api/-default-/public/search/versions/1";
|
||||
restWrapper.configureRequestSpec().setBasePath(RestAssured.basePath);
|
||||
}
|
||||
|
||||
public SearchResponse search(SearchRequest queryBody) throws Exception
|
||||
public SearchResponse search(SearchRequest queryBody)
|
||||
{
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, queryBody.toJson(), "search");
|
||||
return restWrapper.processModels(SearchResponse.class, request);
|
||||
|
@@ -127,11 +127,12 @@ public class SearchSQLAPI extends ModelRequest<SearchSQLAPI>
|
||||
public SearchSQLAPI(RestWrapper restWrapper)
|
||||
{
|
||||
super(restWrapper);
|
||||
restWrapper.configureAlfrescoEndpoint();
|
||||
RestAssured.basePath = "alfresco/api/-default-/public/search/versions/1";
|
||||
restWrapper.configureRequestSpec().setBasePath(RestAssured.basePath);
|
||||
}
|
||||
|
||||
public RestResponse searchSql(SearchSqlRequest query) throws Exception
|
||||
public RestResponse searchSql(SearchSqlRequest query)
|
||||
{
|
||||
String stmt = (null == query.getSql() || query.getSql().isEmpty()) ? "" : query.getSql();
|
||||
|
||||
|
@@ -42,6 +42,7 @@ public class ShardInfoAPI extends ModelRequest<ShardInfoAPI>
|
||||
public ShardInfoAPI(RestWrapper restWrapper)
|
||||
{
|
||||
super(restWrapper);
|
||||
restWrapper.configureAlfrescoEndpoint();
|
||||
RestAssured.basePath = "alfresco/api/-default-/private/search/versions/1";
|
||||
restWrapper.configureRequestSpec().setBasePath(RestAssured.basePath);
|
||||
}
|
||||
|
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Alfresco Software Limited.
|
||||
* This file is part of Alfresco
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.rest.requests.search;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.rest.core.RestRequest;
|
||||
import org.alfresco.rest.core.RestResponse;
|
||||
import org.alfresco.rest.core.RestWrapper;
|
||||
import org.alfresco.rest.requests.ModelRequest;
|
||||
import org.springframework.http.HttpMethod;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.http.Header;
|
||||
import io.restassured.http.Headers;
|
||||
|
||||
/**
|
||||
* Wrapper for SOLR Admin REST API
|
||||
*
|
||||
* @author aborroy
|
||||
*
|
||||
*/
|
||||
public class SolrAdminAPI extends ModelRequest<SolrAdminAPI>
|
||||
{
|
||||
public SolrAdminAPI(RestWrapper restWrapper)
|
||||
{
|
||||
super(restWrapper);
|
||||
RestAssured.basePath = "solr/admin";
|
||||
|
||||
restWrapper.configureSolrEndPoint();
|
||||
restWrapper.configureRequestSpec().setBasePath(RestAssured.basePath);
|
||||
}
|
||||
|
||||
public RestResponse getAction(String action) 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,
|
||||
"cores?action=" + action + "&wt=json&{parameters}", restWrapper.getParameters());
|
||||
return restWrapper.process(request);
|
||||
}
|
||||
}
|
@@ -57,6 +57,9 @@ public class RestInstanceModel
|
||||
|
||||
/** Transactions remaining */
|
||||
private Long transactionsRemaining;
|
||||
|
||||
/** Sharding Parameters */
|
||||
private String shardParams;
|
||||
|
||||
/**
|
||||
* @return the baseUrl
|
||||
@@ -233,4 +236,21 @@ public class RestInstanceModel
|
||||
{
|
||||
this.transactionsRemaining = transactionsRemaining;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the shardParams
|
||||
*/
|
||||
public String getShardParams()
|
||||
{
|
||||
return this.shardParams;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param shardParams the shardParams to set
|
||||
*/
|
||||
public void setShardParams(String shardParams)
|
||||
{
|
||||
this.shardParams = shardParams;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -34,16 +34,16 @@ public class SearchScoreModel extends TestModel implements IRestModel<SearchScor
|
||||
{
|
||||
|
||||
@JsonProperty(required = true)
|
||||
private int score;
|
||||
private float score;
|
||||
|
||||
private List<ResponseHighLightModel> highlight;
|
||||
|
||||
public int getScore()
|
||||
public float getScore()
|
||||
{
|
||||
return score;
|
||||
}
|
||||
|
||||
public void setScore(int score)
|
||||
public void setScore(float score)
|
||||
{
|
||||
this.score = score;
|
||||
}
|
||||
|
@@ -1,63 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
|
||||
<suite name="REST API" parallel="false" preserve-order="true" thread-count="1">
|
||||
<listeners>
|
||||
<listener class-name="org.alfresco.utility.report.HtmlReportListener"></listener>
|
||||
<listener class-name="org.alfresco.utility.testrail.TestRailExecutorListener"></listener>
|
||||
<listener class-name="org.alfresco.utility.testng.OSTestMethodSelector"></listener>
|
||||
</listeners>
|
||||
<test name="RestAPI">
|
||||
<method-selectors>
|
||||
<!-- -DincludeGroups=sanity,comments,people -DexcludeGroups=networks,othergroup -DrunBugs=true-->
|
||||
<method-selector>
|
||||
<script language="beanshell"><![CDATA[
|
||||
includedGroups = System.getProperty("includeGroups");
|
||||
excludedGroups = System.getProperty("excludeGroups");
|
||||
runBugs = System.getProperty("runBugs");
|
||||
|
||||
if((runBugs != null))
|
||||
{
|
||||
bugAnnotated = method.getAnnotation(org.alfresco.utility.report.Bug.class);
|
||||
|
||||
if (bugAnnotated != null && runBugs.equals("false") )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ((includedGroups == null) || (includedGroups.isEmpty())) {
|
||||
return false;
|
||||
} else
|
||||
{
|
||||
StringTokenizer includedGroupsList = new StringTokenizer(includedGroups, ",");
|
||||
|
||||
if ((excludedGroups != null)) {
|
||||
StringTokenizer excludedGroupsList = new StringTokenizer(excludedGroups, ",");
|
||||
while (excludedGroupsList.hasMoreTokens()) {
|
||||
exG = excludedGroupsList.nextToken();
|
||||
if (groups.containsKey(exG))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
while (includedGroupsList.hasMoreTokens()) {
|
||||
grp = includedGroupsList.nextToken();
|
||||
if ((groups.containsKey(grp)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
]]>
|
||||
</script>
|
||||
</method-selector>
|
||||
</method-selectors>
|
||||
<packages>
|
||||
<package name="org.alfresco.rest.*" />
|
||||
</packages>
|
||||
|
||||
</test> <!-- Test -->
|
||||
</suite> <!-- Suite -->
|
@@ -1,18 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
|
||||
<suite name="REST API">
|
||||
<listeners>
|
||||
<listener class-name="org.alfresco.utility.report.TestCountListener"></listener>
|
||||
</listeners>
|
||||
<test name="RestAPITests">
|
||||
<groups>
|
||||
<run>
|
||||
<exclude name="demo" />
|
||||
<exclude name="unit" />
|
||||
</run>
|
||||
</groups>
|
||||
<packages>
|
||||
<package name="org.alfresco.rest.*"></package>
|
||||
</packages>
|
||||
</test> <!-- Test -->
|
||||
</suite> <!-- Suite -->
|
@@ -1 +0,0 @@
|
||||
∮ E⋅da = Q
|
Binary file not shown.
Before Width: | Height: | Size: 568 KiB |
Binary file not shown.
@@ -1 +0,0 @@
|
||||
<html><head><title>aegif Mind Share Leader Generating New Paradigms by aegif corporation</title></head><body><p> Test html</p></body></html></body></html>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 11 KiB |
Binary file not shown.
Before Width: | Height: | Size: 26 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 28 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,7 +0,0 @@
|
||||
The quick brown fox jumps over the lazy dog
|
||||
|
||||
Le renard brun rapide saute par-dessus le chien paresseux
|
||||
|
||||
Der schnelle braune Fuchs springt über den faulen Hund
|
||||
|
||||
براون وكس السريع يقفز فوق الكلب كسالي
|
Binary file not shown.
Binary file not shown.
@@ -1 +0,0 @@
|
||||
Sample text.
|
Reference in New Issue
Block a user