mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-09-10 14:11:58 +00:00
Compare commits
68 Commits
tas-restap
...
tas-restap
Author | SHA1 | Date | |
---|---|---|---|
|
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 | ||
|
6cc81beab5 | ||
|
9a77903d8c | ||
|
0049eefcdb | ||
|
918d5575ca | ||
|
3c7b48d95c | ||
|
85635663a2 | ||
|
46d42c0910 | ||
|
5cd309d5ff | ||
|
5b5c3ee584 | ||
|
ee3513ddc8 | ||
|
98d90b8008 | ||
|
1847b4e3b0 | ||
|
81dfbe0baf | ||
|
068eb23f88 | ||
|
344caf4904 | ||
|
47bfefb3c4 | ||
|
21c63e382c | ||
|
12a2bb249e |
@@ -22,14 +22,16 @@ 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
|
||||
if: fork = false AND branch = master AND type != pull_request AND commit_message !~ /\[no-release\]/
|
||||
before_install:
|
||||
- "cp .travis.settings.xml $HOME/.m2/settings.xml"
|
||||
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.0</version>
|
||||
<version>1.18</version>
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-super-pom</artifactId>
|
||||
@@ -26,20 +26,19 @@
|
||||
<properties>
|
||||
<!-- please run mvn clean install -DSkipTests in order to have shared-resources available -->
|
||||
<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>2.0.22</tas.utility.version>
|
||||
<tas.utility.version>3.0.15</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.10</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.9</commons-lang3.version>
|
||||
<scribejava-apis.version>6.9.0</scribejava-apis.version>
|
||||
<test.exclude />
|
||||
<test.include />
|
||||
<java.version>11</java.version>
|
||||
@@ -49,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.0</tag>
|
||||
<tag>v1.18</tag>
|
||||
</scm>
|
||||
|
||||
<issueManagement>
|
||||
@@ -96,33 +95,15 @@
|
||||
</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>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<configuration>
|
||||
<includes>
|
||||
<include>shared-resources/**/*</include>
|
||||
</includes>
|
||||
<resourceBundles>
|
||||
<resourceBundle>org.alfresco.tas:utility:${tas.utility.version}</resourceBundle>
|
||||
</resourceBundles>
|
||||
<doclint>none</doclint>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-javadocs</id>
|
||||
<goals>
|
||||
<goal>process</goal>
|
||||
<goal>bundle</goal>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
@@ -147,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>
|
||||
@@ -180,14 +149,6 @@
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<includes>
|
||||
<include>shared-resources/**/*</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
@@ -196,7 +157,7 @@
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
<version>2.4</version>
|
||||
<version>2.5</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -294,7 +255,7 @@
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.7.2</version>
|
||||
<version>1.7.29</version>
|
||||
</dependency>
|
||||
|
||||
<!-- swagger parser -->
|
||||
@@ -321,14 +282,14 @@
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<artifactId>groovy</artifactId>
|
||||
<version>2.5.5</version>
|
||||
<version>2.5.8</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.8</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
@@ -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()
|
||||
|
@@ -96,6 +96,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 +148,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 +363,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 +414,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 +632,7 @@ public class RestWrapper extends DSLWrapper<RestWrapper>
|
||||
|
||||
logResponseInformation(restRequest, returnedResponse);
|
||||
|
||||
initializeRequestSpecBuilder();
|
||||
configureServerEndpoint();
|
||||
response = new RestResponse(returnedResponse);
|
||||
return returnedResponse;
|
||||
}
|
||||
@@ -1096,17 +1107,31 @@ 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);
|
||||
}
|
||||
}
|
@@ -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);
|
||||
}
|
||||
}
|
@@ -1,34 +1,13 @@
|
||||
|
||||
package org.alfresco.rest.requests;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import javax.json.JsonArrayBuilder;
|
||||
|
||||
import io.restassured.http.ContentType;
|
||||
import org.alfresco.rest.core.JsonBodyGenerator;
|
||||
import org.alfresco.rest.core.RestRequest;
|
||||
import org.alfresco.rest.core.RestResponse;
|
||||
import org.alfresco.rest.core.RestWrapper;
|
||||
import org.alfresco.rest.exception.JsonToModelConversionException;
|
||||
import org.alfresco.rest.model.RestActionDefinitionModelsCollection;
|
||||
import org.alfresco.rest.model.RestCommentModel;
|
||||
import org.alfresco.rest.model.RestCommentModelsCollection;
|
||||
import org.alfresco.rest.model.RestNodeAssocTargetModel;
|
||||
import org.alfresco.rest.model.RestNodeAssociationModel;
|
||||
import org.alfresco.rest.model.RestNodeAssociationModelCollection;
|
||||
import org.alfresco.rest.model.RestNodeBodyModel;
|
||||
import org.alfresco.rest.model.RestNodeBodyMoveCopyModel;
|
||||
import org.alfresco.rest.model.RestNodeChildAssocModelCollection;
|
||||
import org.alfresco.rest.model.RestNodeModel;
|
||||
import org.alfresco.rest.model.RestNodeModelsCollection;
|
||||
import org.alfresco.rest.model.RestRatingModel;
|
||||
import org.alfresco.rest.model.RestRatingModelsCollection;
|
||||
import org.alfresco.rest.model.RestRenditionInfoModel;
|
||||
import org.alfresco.rest.model.RestRenditionInfoModelCollection;
|
||||
import org.alfresco.rest.model.RestTagModel;
|
||||
import org.alfresco.rest.model.RestTagModelsCollection;
|
||||
import org.alfresco.rest.model.RestVersionModel;
|
||||
import org.alfresco.rest.model.RestVersionModelsCollection;
|
||||
import org.alfresco.rest.model.*;
|
||||
import org.alfresco.rest.model.body.RestNodeLockBodyModel;
|
||||
import org.alfresco.rest.model.builder.NodesBuilder;
|
||||
import org.alfresco.utility.Utility;
|
||||
@@ -37,7 +16,8 @@ import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.reporters.Files;
|
||||
|
||||
import io.restassured.http.ContentType;
|
||||
import javax.json.JsonArrayBuilder;
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* Declares all Rest API under the /nodes path
|
||||
@@ -391,6 +371,25 @@ public class Node extends ModelRequest<Node>
|
||||
restWrapper.processEmptyModel(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if specified rendition exists and if not
|
||||
* create node rendition using POST call on '/nodes/{nodeId}/renditions'
|
||||
*
|
||||
* @param renditionId id of rendition to be created
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public void createNodeRenditionIfNotExists(String renditionId) throws Exception
|
||||
{
|
||||
getNodeRendition(renditionId);
|
||||
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());
|
||||
restWrapper.processEmptyModel(request);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get node rendition using GET call on '/nodes/{nodeId}/renditions/{renditionId}
|
||||
*
|
||||
@@ -416,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)
|
||||
{
|
||||
@@ -443,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,11 +81,11 @@ 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)
|
||||
{
|
||||
Utility.waitToLoopTime(2);
|
||||
Thread.sleep(300);
|
||||
activityCollection = restWrapper.processModels(RestActivityModelsCollection.class, request);
|
||||
retry++;
|
||||
}
|
||||
|
@@ -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
|
||||
*/
|
||||
@@ -204,9 +196,8 @@ public class Site extends ModelRequest<Site>
|
||||
* 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 +207,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 +219,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);
|
||||
|
@@ -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
|
||||
@@ -40,7 +39,7 @@ public class SearchAPI extends ModelRequest<SearchAPI>
|
||||
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);
|
||||
|
@@ -131,7 +131,7 @@ public class SearchSQLAPI extends ModelRequest<SearchSQLAPI>
|
||||
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();
|
||||
|
||||
|
@@ -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