Merge pull request #1560 from Alfresco/feature/ACS-4005_MergeTASRESTAPI

ACS-4005 Merge alfresco-tas-restapi into communty repo.
This commit is contained in:
Tom Page
2022-12-06 12:25:45 +00:00
committed by GitHub
306 changed files with 34098 additions and 483 deletions

View File

@@ -396,7 +396,7 @@ jobs:
script: travis_retry travis_wait 80 mvn -B verify -Dmaven.javadoc.skip=true -Dmaven.source.skip=true -Pags -Pstart-mysql -PagsAllTestSuitePt4 -f amps/ags/pom.xml ${LOG_WARN}
- name: "AGS Community Rest API Tests"
if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip ags\]/) OR commit_message =~ /\[ags\]/
if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip ags\]/ AND commit_message !~ /\[skip tas\]/) OR (commit_message =~ /\[ags\]/ AND commit_message =~ /\[tas\]/)
install: travis_retry travis_wait 40 env REQUIRES_LOCAL_IMAGES=true bash scripts/travis/build.sh
addons:
artifacts:
@@ -408,7 +408,8 @@ jobs:
before_script:
- ${TAS_SCRIPTS}/start-compose.sh ./amps/ags/rm-community/rm-community-repo/docker-compose.yml
- ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8080/alfresco"
script: travis_wait 40 mvn -B test -pl :alfresco-governance-services-automation-community-rest-api -am -DfailIfNoTests=false -Dskip.automationtests=false -Pags
- travis_wait 40 mvn -B install -pl :alfresco-governance-services-automation-community-rest-api -am -Pags -Pall-tas-tests -DskipTests
script: travis_wait 40 mvn -B test -pl :alfresco-governance-services-automation-community-rest-api -Dskip.automationtests=false -Pags -Pall-tas-tests
after_script: bash amps/ags/travis/scripts/getLogs.sh
- name: "Push to Nexus"

View File

@@ -12,9 +12,17 @@
<modules>
<module>rm-community</module>
<module>rm-automation</module>
</modules>
<profiles>
<profile>
<id>all-tas-tests</id>
<modules>
<module>rm-automation</module>
</modules>
</profile>
</profiles>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

View File

@@ -57,6 +57,7 @@
<dependency>
<groupId>org.alfresco.tas</groupId>
<artifactId>restapi</artifactId>
<version>${project.version}</version>
<exclusions>
<exclusion>
<groupId>org.alfresco.tas</groupId>

View File

@@ -66,6 +66,7 @@
<dependency>
<groupId>org.alfresco.tas</groupId>
<artifactId>restapi</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>

View File

@@ -0,0 +1,564 @@
![in progress](https://img.shields.io/badge/Document_Level-In_Progress-yellow.svg?style=flat-square)
Back to [TAS Master Documentation](https://git.alfresco.com/tas/alfresco-tas-utility/wikis/home)
---
## Table of Contents
* [Synopsis](#synopsis)
* [Prerequisite](#prerequisite)
* [Installation](#installation-if-you-want-to-contribute)
* [Package Presentation](#package-presentation)
* [Sample Usage](#sample-usage)
* [How to write a test](#how-to-write-a-test)
* [How to generate models or check coverage](#how-to-generate-models-or-check-coverage)
* [How to run tests?](#how-to-run-tests)
* [from IDE](#from-ide)
* [from command line](#from-command-line)
* [Listeners](#listeners)
* [Test Results](#test-results)
* [Test Rail Integration](#test-rail-integration)
* [Configuration](#configuration)
* [How to enable Test Rail Integration?](#how-to-enable-test-rail-integration)
* [Reference](#reference)
* [Change Log](docs/CHANGELOG.md) 🌟
* [Contributors](#contributors)
* [Releasing](#releasing)
* [License](#license)
## Synopsis
**TAS**( **T**est **A**utomation **S**ystem)- **RESTAPI** is the project that handles the automated tests related only to [Alfresco REST API](http://docs.alfresco.com/5.1/pra/1/topics/pra-welcome.html).
It is based on Apache Maven, compatible with major IDEs and is using also Spring capabilities for dependency injection.
As a high level overview, this project makes use of the following functionality useful in automation testing as:
* reading/defining test environment settings (e.g. alfresco server details, authentication, etc.)
* managing resource (i.e. creating files and folders)
* test data generators (for site, users, content, etc)
* helpers (i.e. randomizers, test environment information)
* test logging generated on runtime and test reporting capabilities
* test management tool integration (at this point we support integration with [Test Rail](https://alfresco.testrail.net) (v5.2.1)
* health checks (verify if server is reachable, if server is online)
* generic Internal-DSL (Domain Specific Language)
Using Nexus -Release Repository, everyone will be able to use individual interfaces in their projects by extending the automation core functionalities.
**[Back to Top ^](#table-of-contents)**
## Prerequisite
(tested on unix/non-unix destribution)
* [Java SE 1.8](http://www.oracle.com/technetwork/java/javase/downloads/index.html).
* [Maven 3.3](https://maven.apache.org/download.cgi) installed and configure according to [Windows OS](https://maven.apache.org/guides/getting-started/windows-prerequisites.html) or [Mac OS](https://maven.apache.org/install.html).
* Configure Maven to use Alfresco alfresco-internal repository following this [Guide](https://ts.alfresco.com/share/page/site/eng/wiki-page?title=Maven_Setup).
* Your favorite IDE as [Eclipse](https://eclipse.org/downloads/) or [InteliJ](https://www.jetbrains.com/idea).
* Access to [Nexus](https://nexus.alfresco.com/nexus/) repository.
* Access to Gitlab [TAS](https://gitlab.alfresco.com/tas/) repository.
* GitLab client for your operating system. (we recommend [SourceTree](https://www.sourcetreeapp.com) - use your google account for initial setup).
* Getting familiar with [Basic Git Commands](http://docs.gitlab.com/ee/gitlab-basics/basic-git-commands.html).
* Getting familiar with [Maven](https://maven.apache.org/guides/getting-started/maven-in-five-minutes.html).
* Getting familiar with [Spring](http://docs.spring.io).
* Getting familiar with [TestNG](http://testng.org/doc/index.html)
**[Back to Top ^](#table-of-contents)**
## Installation (if you want to contribute)
* Open your Gitlab client and clone the repository of this project.
* You can do this also from command line (or in your terminal) adding:
```bash
$ git clone https://git.alfresco.com/tas/alfresco-tas-restapi-test.git
# this clone will have the latest changes from repository. If you want to checkout a specific version released, take a look at the [Change Log](docs/CHANGELOG.md) page
$ cd alfresco-tas-tester
# this command will checkout the remove v2.0.0 tagged repository and create locally a new branch v2.0.0
$ git checkout tags/v2.0.0 -b v2.0.0
```
* Install and check if all dependencies are downloaded
```bash
> cd alfresco-tas-restapi-test
> mvn clean install -DskipTests
# you should see one [INFO] BUILD SUCCESS message displayed
```
**[Back to Top ^](#table-of-contents)**
## Package Presentation
The project uses a maven layout [archetype](https://maven.apache.org/plugins-archives/maven-archetype-plugin-1.0-alpha-7/examples/simple.html):
```ruby
├── pom.xml
├── report.html
├── src
   ├── main
      └── java
      └── org
      └── alfresco
      └── rest
      ├── core
         ├── assertion
  ├── IModelAssertion.java
        ├── IModelsCollectionAssertion.java
        ├── (...)
        └── PaginationAssertionVerbs.java
         ├── swagger
      ├── Generator.java
      ├── RestModelProperty.java
      ├── (...)
      └── SwaggerYamlParser.java
         ├── IRestModel.java
         ├── IRestModelsCollection.java
         ├── (...)
         ├── RestResponse.java
         └── RestWrapper.java
      ├── exception
         ├── EmptyJsonResponseException.java
      ├── EmptyRestModelCollectionException.java
      └── JsonToModelConversionException.java
      ├── model
  ├── builder  
        └── NodesBuilder.java
      ├── RestActivityModel.java
      ├── RestActivityModelsCollection.java
      ├── (...)
      └── RestVariableModelsCollection.java
├── requests
├── authAPI  
        └── RestAuthAPI.java
      ├── coreAPI
└── RestCoreAPI.java
      ├── workflowAPI
└── RestWorkflowAPI.java
├── Deployments.java
      ├── (...)
      └── Tenant.java
   ├── test
      ├── java
         └── org
         └── alfresco
         └── rest
         ├── auth
└── AuthTests.java
├── comments
├── AddCommentCoreTests.java
├── (...)
         ├── (...)
├── workflow
├── deployments
├── DeleteDeploymentCoreFullTests.java
├── (...)
├── processDefinitions
├── GetProcessDefinitionCoreTests.java
├── (...)
├── (...)
         ├── FunctionalCasesTests.java
         └── RestTest.java
      └── resources
      ├── alfresco-restapi-context.xml
      ├── default.properties
      └── log4j.properties
```
**[Back to Top ^](#table-of-contents)**
## Sample Usage
Following the standard layout for Maven projects, the application sources locate in src/main/java and test sources locate in src/test/java.
Application sources consist in defining the REST API object that simulates the calls: get, post, put, delete.
The tests are based on an abstract object: Rest.java that handles the common behavior: checking the health status of the test server, configuration settings, getting the general properties, etc.
Please take a look at [RestDemoTests.java](src/test/java/org/alfresco/rest/demo/RestDemoTests.java) class for an example.
Common configuration settings required for this project are stored in properties file, see [default.properties](src/test/resources/default.properties).
Please analyze and update it accordingly with Alfresco test server IP, port, credentials, etc.
Example:
```java
# Alfresco HTTP Server Settings
alfresco.scheme=http
alfresco.server=<add-here-the-ip-of-your-test-server>
alfresco.port=<default-port-for-alfresco-not-share>
```
* optional update the logging level in [log4j](src/test/resources/log4j.properties) file (you can increase/decrease the deails of the [logging file](https://logging.apache.org/log4j/1.2/manual.html), setting the ```log4j.rootLogger=DEBUG``` if you want.)
* go to [running](#how-to-run-tests) section for more information on how to run this tests.
**[Back to Top ^](#table-of-contents)**
### How to write a test
* Please also take a look at the [Rest-API desing and implementation](https://ts.alfresco.com/share/page/site/eng/document-details?nodeRef=workspace://SpacesStore/9f7823e7-0597-4435-9fd1-6ec8a4791259) guidelines.
* Tests are organized in java classes and located on src/test/java as per maven layout.
* One test class should contain the tests that cover one functionality as we want to have a clear separation of test scope: tests for sanity/core/full, tests that verify manage of folder/files etc.
* These are the conventions that need to follow when you write a test:
* The test class has @Test annotation with the group defined: rest-api. You can add more groups like sanity, regression
```java
@Test(groups={ TestGroup.COMMENTS}
```
* The test has @TestRail annotation in order to assure that the details and results will be submitted on TestRail. The fields for TestRail annotation will be explained on next chapter.
```java
@TestRail(section={TestGroup.REST_API, TestGroup.PEOPLE}, executionType= ExecutionType.SANITY,
description = "Verify admin user gets person with Rest API and response is not empty")
public void adminShouldRetrievePerson() throws Exception
{
peopleAPI.getPerson(userModel.getUsername())
.assertResponseIsNotEmpty();
restClient.assertStatusCodeIs(HttpStatus.OK.toString());
}
```
* Use Spring capabilities to initialize the objects(Models, Wrappers) with @Autowired
* To view a simple class that is using this utility, just browse on [RestDemoTests.java]((src/test/java/org/alfresco/rest/demo/RestDemoTests.java)
Notice the class definition and inheritance value:
```java
public class RestDemoTest extends RestTest
```
* as a convention, before running your test, check if the test environment is reachable and your alfresco test server is online.
(this will stop the test if the server defined in your property file is not healthy - method available in parent class)
```java
@BeforeClass(alwaysRun = true)
public void setupRestTest() throws Exception{
serverHealth.assertServerIsOnline();
}
```
* the test name are self explanatory:
```java
@TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.SANITY,
description = "Verify admin user gets sites with Rest API and status code is 200")
public void adminShouldRetrieveSites() throws JsonToModelConversionException, Exception
{
siteAPI.getSites();
restClient()
.assertStatusCodeIs(HttpStatus.OK.toString());
}
```
* Asserting on imbricated keys:
Let's say your response is something like:
```json
{"entry": {
"createdAt": "2017-08-01T12:01:24.979+0000",
"edited": false,
"modifiedBy": {
"firstName": "Administrator"
}
}}
```
if you want to assert that firstName is "Administrator" you can do that using the following DSL:
```java
restClient.onResponse().assertThat().body("entry.modifiedBy.firstName", org.hamcrest.Matchers.is("Administrator"));
```
(notice that i'm using Hamcrest Matcher to finalize this assertion)
**[Back to Top ^](#table-of-contents)**
### How to generate models or check coverage
There are some simple generators that could parse [Swagger YAML](http://docs.alfresco.com/community/concepts/alfresco-sdk-tutorials-using-rest-api-explorer.html) files and provide some usefull information to you like:
a) Show on screen the actual coverage of TAS vs requests that exists in each YAML file - defined in pom.xml)
```bash
mvn exec:java -Dcoverage
```
Any missing request are saved under "missing-requests```<yaml-file-name>```.txt" file for further analysis
All current implementation are saved under "implemented-requests```<yaml-file-name>```.txt"
![](docs/pics/coverage.png)
b) Generate all missing models
```bash
mvn exec:java -Dmodels
```
This command will read all definitions of models from swagger YAML file predefined in pom.xml file.
It will compare with this file pattern: 'Rest```<model-definition-name>```Model.java', file created under ```/src/main/java/org/alfresco/rest/model``` ignoring the ones that are specified in [ignore-models](src/main/java/org/alfresco/rest/model/ignore-models) file.
![](docs/pics/models-all.png)
At this time you you will be prompted to select (based on displayed ID) what models you want to generate (separate each one by comma).
(you can also skip the generation of models from select yaml file or generate all missing models)
c) Generate specific models
Maybe you want to generate/regenerate just one model or multiple ones.
```bash
mvn exec:java -Dmodels=Error,SiteModel
```
This command will parse the Swagger YAML file, and will generate the definition of only those specified models, even if those models exist locally (in this case you will be prompted to override that file or not)
_NOTE_: there are some fields that are marked as ```required``` in swagger file. We also generate those fields with annotation ```@JsonProperty(required = true)```
All models are generated based on a [freemarker](http://freemarker.org) template found [here](src/main/resources/rest-model.ftl).
### How to run tests
#### from IDE
* The project can be imported into a development environment tool (Eclipse or IntelliJ). You have the possibility to execute tests or suite of tests using [TestNG plugin](http://testng.org/doc/eclipse.html) previously installed in IDE.
* In case you are using the default settings that points to localhost (127.0.0.1) and you don't have Alfresco installed on your machine, you will see one exception thrown (as expected):
```java
org.alfresco.utility.exception.ServerUnreachableException: Server {127.0.0.1} is unreachable.
```
#### from command line
* In terminal or CMD, navigate (with CD) to root folder of your project (you can use the sample project):
The tests can be executed on command line/terminal using Maven command
```bash
mvn test
```
This command with trigger the tests specified in the default testng suite from POM file: <suiteXmlFile>src/main/resources/shared-resources/restapi-acs-community-suite.xml</suiteXmlFile>
You can use -Dtest parameter to run the test/suites through command line (http://maven.apache.org/surefire/maven-surefire-plugin/examples/single-test.html).
You can also specify a different suiteXMLFile like:
```bash
mvn test -DsuiteXmlFile=src/resources/your-custom-suite.xml
```
Or even a single test:
```bash
mvn test -Dtest=org.alfresco.rest.RestDemoTest
```
But pay attention that you will not have enabled all the [listeners](#listeners) in this case (the Reporting listener or TestRail integration one)
**[Back to Top ^](#table-of-contents)**
## Listeners
With the help of Listeners we can modify the behavior of TestNG framework. There are a lot of testNG listener interfaces that we can override in order to provide new functionalities.
The TAS framework provides out of the box a couple of listeners that you could use. These could be enabled and added at the class level or suite level.
### a) org.alfresco.utility.report.ReportListenerAdapter
* if added at the class level:
```java
@Listeners(value=ReportListenerAdapter.class)
public class MyTestClass extends RestTest
{
(...)
}
```
* or suite xml level
```java
<suite name="Your Suite test" parallel="classes">
<listeners>
<listener class-name="org.alfresco.utility.report.ReportListenerAdapter"></listener>
</listeners>
(...)
</suite>
```
It will automatically generate one html named "report.html" in ./target/report folder.
Please also take a look at [Test Results](#test-results) section.
### b) org.alfresco.utility.testrail.TestRailExecutorListener
It will automatically update Test Rail application with the test cases that you've automated.
Please take a look at [Test Rail Integration](#test-rail-integration) section for more details.
### c) org.alfresco.utility.report.log.LogsListener
This is a new listener that will generate further details in one XML format of the automated test steps that you will write.
Example:
```java
public void myDSLMethod1()
{
STEP("Lorem ipsum dolor sit amet");
//code for first step
STEP("consectetur adipiscing elit");
//code for the next description
}
public void myDSLMethod2()
{
STEP("sed do eiusmod tempor incididunt ut labore");
//code for first step
STEP("et dolore magna aliqua");
//code for the next description
}
```
If these methods will be executed insite a test method, all those steps will be automatically logged in the XML report generated.
Example:
```java
@Test
public void adminShouldCreateFileInSite()
{
myDSLMethod1();
myDSLMethod2()
}
```
So if "testingSomething" will be executed this is what you will see on the XML file generated. (please take a look at [Test Results](#test-results) section for defining the defaul location)
Here is one example of XML file generated with these steps:
![](docs/pics/xml-steps-report.JPG)
**[Back to Top ^](#table-of-contents)**
## Test Results
We already executed a couple of tests using command line as indicated above. Sweet! Please take a look at [rest-suites.xml](src/main/resources/shared-resources/restapi-acs-community-suite.xml) one more time.
You will see there that we have one listener added:
```java
<listener class-name="org.alfresco.utility.report.HtmlReportListener"></listener>
```
This will tell our framework, after we run all tests, to generate one HTML report file with graphs and metrics.
Take a look at the target/reports folder (created after running the tests) and open the report.html file.
![](docs/pics/html-report-sample.JPG)
Playing with this report, you will notice that you will be able to:
* search tests cases by name
* filter test cases by errors, labels, groups, test types, date when it was executed, protocol used, etc.
* view overall pass/fail metrics of current test suite, history of tests execution, etc.
The report path can be configured in default.properties):
```
# The location of the reports path
reports.path=your-new-location-of-reports
```
**[Back to Top ^](#table-of-contents)**
## Test Rail Integration
Alfresco is using now https://alfresco.testrail.net (v5.3.0.3601).
We aim to accelerate the delivery of automated test by minimizing the interaction with the test management tool - TestRail. In this scope we developed the following capabilities:
* creating automatically the manual tests in TestRail
* submitting the test results (with stack trace) after each execution into TestRail Test Runs
* adding the test steps for each test.
### Configuration
In order to use Test Rail Integration you will need to add a couple of information in [default.properties](src/test/resources/default.properties) file:
(the document is pretty self explanatory)
```java
# Example of configuration:
# ------------------------------------------------------
# testManagement.enabled=<true/false>
# testManagement.endPoint=https://alfresco.testrail.com/
# testManagement.username=<yourusername-that-you-connect-to-testrail>
# testManagement.apiKey=<api-key>
# testManagement.project=<id-of-your-project
# testManagement.includeOnlyTestCasesExecuted=<true/false>
# testManagement.rateLimitInSeconds= 1
# testManagement.testRun=<test-run-name>
# testManagement.suiteId=<suite-id>
```
!This settings are already defined in default.properties for you.
For generating a new API Key take a look at the official documentation, TestRail [APIv2](http://docs.gurock.com/testrail-api2)
* _testManagement.project= **<id-of-your-project**_ this is the ID of the project where you want to store your test cases.
If you want to use [Alfresco ONE](https://alfresco.testrail.net/index.php?/projects/overview/1) project in TestRail, open that project and notice the URL, after "/overview/**1**" link you will see the ID of the project (1 in this case)
If you want to use [TAS Project](https://alfresco.testrail.net/index.php?/projects/overview/7) you will notice the ID 7, so _"testManagement.project=7"_
* "_testManagement.testRun=<test-run-name>_" this represents the name of the Test Run from your project.
* In Test Rail, navigating to Test Runs & Results, create a new Test Run and include all/particular test cases. If this test run name is "Automation", update _testManagement.testRun= **Automation**_.
All test results will be updated only on this test run at runtime as each test is executed by TAS framework.
### How to enable Test Rail Integration?
We wanted to simplify the Test Rail integration, so we used listeners in order to enable/disable the integration of Test Rail.
* first configure your default.properties as indicated above
* now on your TestNG test, add the @TestRail annotation, so let's say you will have this test:
```java
@Test(groups="sample-tests")
public void thisAutomatedTestWillBePublishedInTestRail()
{
}
```
add now @TestRail integration with mandatory field ```section```. This means that this tests annotated, will be uploaded in TestRail:
```java
@Test(groups= TestGroup.REST_API, TestGroup.FULL,)
@TestRail(section = {TestGroup.REST_API, TestGroup.PROCESSES })
public void thisAutomatedTestWillBePublishedInTestRail()
{
}
```
The section field, represents an array of strings, the hierarchy of sections that SHOULD be found on TestRail under the project you've selected in default.properties. Follow the TestRail [user-guide](http://docs.gurock.com/testrail-userguide/start) for more information regarding sections.
In our example we created in Test Rail one root section "restAPI" with a child section: "processes" (you can go further and add multiple section as you wish)
* now, lets add the listener, the TestRailExecutorListener that will handle this TC Management interaction.
This listener can be added at the class level or suite level (approach that we embrace)
Take a look at [restapi-acs-community-suite.xml](src/main/resources/shared-resources/restapi-acs-community-suite.xml) for further example.
```xml
<listeners>
<listener class-name="org.alfresco.utility.report.HtmlReportListener"></listener>
(...)
</listeners>
```
Right click on sanity-suite.xml file and run it, or just "mvn test" from root if this sample project.
After everything passes, go in Test Rail, open your project and navigate to "Test Cases" section. Notice that under restApi/processes section, you will see your test case published.
If you defined also the "testManagement.testRun" correctly, you will see under Test Runs, the status of this case marked as passed.
The @TestRail annotation offers also other options like:
- "description" this is the description that will be updated in Test Rail for your test case
- "testType", the default value is set to Functional test
- "executionType", default value is set to ExecutionType.REGRESSION, but you can also use ExecutionType.SMOKE, ExecutionType.SANITY, etc
Take a look at the demo scenarios in this project for further examples.
**[Back to Top ^](#table-of-contents)**
## Reference
* For any improvements, bugs, please use Jira - [TAS](https://issues.alfresco.com/jira/browse/TAS) project.
* Setup the environment using [docker](https://gitlab.alfresco.com/tas/alfresco-docker-provisioning/blob/master/Readme.md).
* [Bamboo Test Plan](https://bamboo.alfresco.com/bamboo/browse/TAS-RESTAPI)
## Contributors
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other... [more](CODE_OF_CONDUCT.md)
## Releasing
Any commit done on this project should be automatically executed by [TAS Build Plan](https://bamboo.alfresco.com/bamboo/browse/TAS-TAS)
If the build passes, then you didn't broke anything.
If you want to perform a release, open [TAS-RestAPI](https://bamboo.alfresco.com/bamboo/browse/TAS-RESTAPI) Bamboo Build.
Run the Default stage and if it passes, then manually perform the Release stage (this will auto-increment the version in pom.xml)

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

View File

@@ -2,9 +2,8 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.alfresco.tas</groupId>
<artifactId>alfresco-community-repo-restapi-test</artifactId>
<name>restapi test</name>
<packaging>jar</packaging>
<artifactId>restapi</artifactId>
<name>alfresco-tas-restapi</name>
<parent>
<groupId>org.alfresco</groupId>
@@ -12,17 +11,17 @@
<version>20.32-SNAPSHOT</version>
</parent>
<developers>
<developer>
<name>Paul Brodner</name>
<roles>
<role>Test Automation Architect</role>
</roles>
</developer>
</developers>
<properties>
<suiteXmlFile>${project.basedir}/src/test/resources/restapi-suite.xml</suiteXmlFile>
<maven.build.sourceVersion>11</maven.build.sourceVersion>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<rest.api.explorer.branch>master</rest.api.explorer.branch>
<httpclient-osgi-version>4.5.6</httpclient-osgi-version>
<org.glassfish.version>1.1.4</org.glassfish.version>
<commons-lang3.version>3.12.0</commons-lang3.version>
<scribejava-apis.version>8.3.1</scribejava-apis.version>
<license-maven-plugin.version>2.0.1.alfresco-2</license-maven-plugin.version>
<java.version>11</java.version>
</properties>
<profiles>
@@ -47,26 +46,146 @@
</profiles>
<dependencies>
<!-- fix the info log messages related to Could not instantiate TestExecutionListener
[org.springframework.test.context.web.ServletTestExecutionListener -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<!-- alfresco tester settings -->
<dependency>
<groupId>org.alfresco.tas</groupId>
<artifactId>restapi</artifactId>
<scope>test</scope>
<artifactId>utility</artifactId>
<exclusions>
<exclusion>
<artifactId>slf4j-api</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
<exclusion>
<artifactId>commons-lang3</artifactId>
<groupId>org.apache.commons</groupId>
</exclusion>
<exclusion>
<artifactId>commons-lang</artifactId>
<groupId>commons-lang</groupId>
</exclusion>
<exclusion>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons-lang3.version}</version>
</dependency>
<!-- REST ASSURED -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient-osgi</artifactId>
<version>${httpclient-osgi-version}</version>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>json-path</artifactId>
<exclusions>
<exclusion>
<artifactId>commons-lang3</artifactId>
<groupId>org.apache.commons</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>xml-path</artifactId>
<exclusions>
<exclusion>
<artifactId>commons-lang3</artifactId>
<groupId>org.apache.commons</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>json-schema-validator</artifactId>
</dependency>
<dependency>
<groupId>com.github.scribejava</groupId>
<artifactId>scribejava-apis</artifactId>
<version>${scribejava-apis.version}</version>
</dependency>
<!-- JSON to Object -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.glassfish/javax.json -->
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.json</artifactId>
<version>${org.glassfish.version}</version>
</dependency>
<!-- swagger parser -->
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-parser</artifactId>
<exclusions>
<exclusion>
<artifactId>commons-lang3</artifactId>
<groupId>org.apache.commons</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
</dependency>
<!--fixing java.lang.ClassCastException: class [B cannot be cast to class [C ([B and [C are in module java.base of loader 'bootstrap') -->
<!-- https://mvnrepository.com/artifact/org.codehaus.groovy/groovy -->
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy</artifactId>
<version>3.0.12</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.codehaus.groovy/groovy-json-->
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-json</artifactId>
<version>3.0.12</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>jakarta.json</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
@@ -96,6 +215,32 @@
</goals>
</execution>
</executions>
<configuration>
<excludes>
<exclude>**/*UnitTest*</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<arguments>
<argument>https://raw.githubusercontent.com/Alfresco/rest-api-explorer/${rest.api.explorer.branch}/src/main/webapp/definitions/alfresco-auth.yaml</argument>
<argument>https://raw.githubusercontent.com/Alfresco/rest-api-explorer/${rest.api.explorer.branch}/src/main/webapp/definitions/alfresco-core.yaml</argument>
<argument>https://raw.githubusercontent.com/Alfresco/rest-api-explorer/${rest.api.explorer.branch}/src/main/webapp/definitions/alfresco-discovery.yaml</argument>
<argument>https://raw.githubusercontent.com/Alfresco/rest-api-explorer/${rest.api.explorer.branch}/src/main/webapp/definitions/alfresco-search.yaml</argument>
<argument>https://raw.githubusercontent.com/Alfresco/rest-api-explorer/${rest.api.explorer.branch}/src/main/webapp/definitions/alfresco-workflow.yaml</argument>
</arguments>
<mainClass>org.alfresco.rest.core.swagger.Generator</mainClass>
</configuration>
</plugin>
</plugins>
</build>

View File

@@ -0,0 +1,70 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest;
import org.alfresco.rest.model.RestNetworkModel;
import org.alfresco.utility.model.UserModel;
public abstract class NetworkDataPrep extends RestTest
{
protected static UserModel adminUserModel;
protected static UserModel adminTenantUser, secondAdminTenantUser;
protected static UserModel tenantUser, secondTenantUser, differentNetworkTenantUser;
protected static UserModel tenantUserWithBad;
protected static UserModel userModel;
protected static RestNetworkModel restNetworkModel;
protected static String tenantDomain;
private static boolean isInitialized = false;
public void init()
{
if(!isInitialized)
{
isInitialized = true;
initialization();
}
}
public void initialization()
{
adminUserModel = dataUser.getAdminUser();
//create first tenant Admin User.
adminTenantUser = UserModel.getAdminTenantUser();
restClient.authenticateUser(adminUserModel);
restClient.usingTenant().createTenant(adminTenantUser);
tenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("uTenant");
secondTenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("sTenant");
//create second tenant Admin User.
secondAdminTenantUser = UserModel.getAdminTenantUser();
restClient.usingTenant().createTenant(secondAdminTenantUser);
tenantDomain = tenantUser.getDomain();
differentNetworkTenantUser = dataUser.usingUser(secondAdminTenantUser).createUserWithTenant("dTenant");
userModel = dataUser.createRandomTestUser();
}
}

View File

@@ -1,3 +1,28 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest;
import java.lang.reflect.Method;
@@ -5,7 +30,6 @@ import java.lang.reflect.Method;
import org.alfresco.dataprep.WorkflowService;
import org.alfresco.rest.core.RestProperties;
import org.alfresco.rest.core.RestWrapper;
import org.alfresco.rest.rules.RulesTestsUtils;
import org.alfresco.utility.LogFactory;
import org.alfresco.utility.TasProperties;
import org.alfresco.utility.data.DataContent;
@@ -62,15 +86,19 @@ public abstract class RestTest extends AbstractTestNGSpringContextTests
@Autowired
protected WorkflowService workflow;
@Autowired
protected RulesTestsUtils rulesUtils;
protected SiteModel testSite;
@BeforeSuite(alwaysRun = true)
public void checkServerHealth() throws Exception
public void checkServerHealth()
{
super.springTestContextPrepareTestInstance();
try
{
super.springTestContextPrepareTestInstance();
}
catch (Exception e)
{
throw new IllegalStateException("Error while preparing for test execution", e);
}
serverHealth.assertServerIsOnline();
testSite = dataSite.createPublicRandomSite();
}

View File

@@ -0,0 +1,32 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.core;
import org.alfresco.rest.core.assertion.IModelAssertion;
public interface IRestModel<Model> extends IModelAssertion<Model> {
Model onModel();
}

View File

@@ -0,0 +1,46 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.core;
import java.util.List;
import org.alfresco.rest.exception.EmptyRestModelCollectionException;
import org.alfresco.rest.model.RestPaginationModel;
public interface IRestModelsCollection<Model> {
public List<Model> getEntries();
public Model getOneRandomEntry() throws EmptyRestModelCollectionException;
/**
* @return boolean value if entry is empty
*/
public boolean isEmpty();
public RestPaginationModel getPagination();
}

View File

@@ -0,0 +1,370 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.core;
import javax.json.Json;
import javax.json.JsonArrayBuilder;
import javax.json.JsonBuilderFactory;
import javax.json.JsonObject;
import javax.json.JsonObjectBuilder;
import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.StringJoiner;
import org.alfresco.dataprep.CMISUtil.Priority;
import org.alfresco.rest.model.RestProcessVariableModel;
import org.alfresco.rest.model.RestVariableModel;
import org.alfresco.utility.Utility;
import org.alfresco.utility.constants.UserRole;
import org.alfresco.utility.model.FileModel;
import org.alfresco.utility.model.FolderModel;
import org.alfresco.utility.model.RepoTestModel;
import org.alfresco.utility.model.SiteModel;
import org.alfresco.utility.model.TestModel;
import org.alfresco.utility.model.UserModel;
/**
* Json builder for small post calls
*/
public class JsonBodyGenerator
{
private static JsonBuilderFactory jsonBuilder;
/**
* @return {@link JsonObjectBuilder}
*/
public static JsonObjectBuilder defineJSON()
{
return jsonBuilder().createObjectBuilder();
}
/**
* @return {@link JsonArrayBuilder}
*/
public static JsonArrayBuilder defineJSONArray()
{
return jsonBuilder().createArrayBuilder();
}
/**
* {
* "tag":"test-tag-1"
* }
*
* @param key
* @param value
* @return
*/
public static String keyValueJson(String key, String value)
{
return defineJSON().add(key, value).build().toString();
}
/**
* {
* "target": {
* "site": {
* "guid": "abcde-01234"
* }
* }
* }
*
* @param siteModel
* @return
*/
public static String targetSiteWithGuid(SiteModel siteModel)
{
JsonObject value = defineJSON()
.add("target", defineJSON()
.add("site", defineJSON()
.add("guid", siteModel.getGuid()))).build();
return value.toString();
}
/**
* {
* "target": {
* "file": {
* "guid": "abcde-01234"
* }
* }
* }
*
* @param siteModel
* @return
*/
public static String targetFileWithGuid(FileModel fileModel)
{
JsonObject value = defineJSON()
.add("target", defineJSON()
.add("file", defineJSON()
.add("guid", fileModel.getNodeRef().replace(";1.0", "")))).build();
return value.toString();
}
/**
* {
* "target": {
* "folder": {
* "guid": "abcde-01234"
* }
* }
* }
*
* @param siteModel
* @return
*/
public static String targetFolderWithGuid(FolderModel folderModel)
{
JsonObject value = defineJSON()
.add("target", defineJSON()
.add("folder", defineJSON()
.add("guid", folderModel.getNodeRef()))).build();
return value.toString();
}
/**
* @return the initialized JSON builder
*/
private static JsonBuilderFactory jsonBuilder()
{
if (jsonBuilder == null)
return Json.createBuilderFactory(null);
else
{
return jsonBuilder;
}
}
public static String likeRating(boolean likeOrNot)
{
JsonObject value = defineJSON()
.add("id", "likes")
.add("myRating", likeOrNot).build();
return value.toString();
}
public static String fiveStarRating(int stars)
{
JsonObject value = defineJSON()
.add("id", "fiveStar")
.add("myRating", stars).build();
return value.toString();
}
public static String siteMember(UserModel userModel)
{
Utility.checkObjectIsInitialized(userModel.getUserRole(), "userModel.getUserRole()");
JsonObject value = defineJSON()
.add("role", userModel.getUserRole().name())
.add("id", userModel.getUsername()).build();
return value.toString();
}
public static String siteGroup(String authorityId, UserRole role)
{
Utility.checkObjectIsInitialized(authorityId, "authorityId");
JsonObject value = defineJSON()
.add("role", role.name())
.add("id", authorityId).build();
return value.toString();
}
public static String siteMemberhipRequest(String message, SiteModel siteModel, String title)
{
JsonObject value = defineJSON()
.add("message", message)
.add("id", siteModel.getId())
.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)
{
JsonObject value = defineJSON()
.add("processDefinitionKey", processDefinitionKey)
.add("variables", jsonBuilder().createObjectBuilder()
.add("bpm_assignee", assignee.getUsername())
.add("bpm_sendEMailNotifications", sendEmailNotifications)
.add("bpm_workflowPriority", priority.getLevel())).build();
return value.toString();
}
public static String processVariable(RestProcessVariableModel variableModel)
{
JsonObject value = defineJSON()
.add("name", variableModel.getName())
.add("value", variableModel.getValue())
.add("type", variableModel.getType()).build();
return value.toString();
}
public static String taskVariable(RestVariableModel taskVariableModel)
{
JsonObject value = defineJSON()
.add("scope", taskVariableModel.getScope())
.add("name", taskVariableModel.getName())
.add("type", taskVariableModel.getType())
.add("value", taskVariableModel.getValue().toString()).build();
return value.toString();
}
/**
* {
* "actionDefinitionId": "copy",
* "targetId": "4c4b3c43-f18b-43ff-af84-751f16f1ddfd",
* "params": {
"destination-folder": "34219f79-66fa-4ebf-b371-118598af898c"
* }
* }
*
* @param actionDefinitionId
* @param targetNode
* @param params
* @return
*/
public static String executeActionPostBody(String actionDefinitionId, RepoTestModel targetNode, Map<String, Serializable> params)
{
JsonObjectBuilder objectBuilder = jsonBuilder().createObjectBuilder();
for(Map.Entry<String, Serializable> param : params.entrySet())
{
addJsonValue(objectBuilder, param.getKey(), param.getValue());
}
JsonObject value = defineJSON()
.add("actionDefinitionId", actionDefinitionId)
.add("targetId", targetNode.getNodeRefWithoutVersion())
.add("params", objectBuilder).build();
return value.toString();
}
/** Add a value to the JSON object. */
private static void addJsonValue(JsonObjectBuilder objectBuilder, String key, Serializable value)
{
if (value == null)
{
objectBuilder.add(key, JsonObject.NULL);
}
else if (value instanceof Boolean)
{
objectBuilder.add(key, (boolean) value);
}
else if (value instanceof String)
{
objectBuilder.add(key, (String) value);
}
else if (value instanceof Integer)
{
objectBuilder.add(key, (int) value);
}
else if (value instanceof Long)
{
objectBuilder.add(key, (long) value);
}
else if (value instanceof Double)
{
objectBuilder.add(key, (double) value);
}
else
{
throw new UnsupportedOperationException("Unable to add entry to JsonObject: {" + key + ": " + value + "}");
}
}
/**
* {
* "actionDefinitionId": "check-out",
* "targetId": "4c4b3c43-f18b-43ff-af84-751f16f1ddfd",
* }
*
* @param actionDefinitionId
* @param targetNode
* @return
*/
public static String executeActionPostBody(String actionDefinitionId, RepoTestModel targetNode)
{
JsonObject value = defineJSON()
.add("actionDefinitionId", actionDefinitionId)
.add("targetId", targetNode.getNodeRefWithoutVersion())
.build();
return value.toString();
}
/**
* {
* "key1":"key1",
* "key2":"key2",
* "key3":"key3"
* }
*
* @param key
* @param value
* @return
*/
public static String keyValueJson(HashMap<String, String> mapJson)
{
JsonObjectBuilder builder= defineJSON();
for (Map.Entry<String, String> entry : mapJson.entrySet())
{
builder.add(entry.getKey().toString(), entry.getValue().toString());
}
return builder.build().toString();
}
/**
* Convert a collection of {@link TestModel} objects to JSON for a multi-entity POST request.
*
* @param models The entities to convert.
* @return The JSON string.
*/
public static String arrayToJson(List<? extends TestModel> models)
{
// Rather than convert backwards and forwards between Jackson and javax objects then we handle array creation ourselves.
StringJoiner stringJoiner = new StringJoiner(",\n");
for (TestModel model : models)
{
stringJoiner.add(model.toJson());
}
return "[\n" + stringJoiner.toString() + "\n]";
}
}

View File

@@ -0,0 +1,108 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.core;
import static org.alfresco.utility.report.log.Step.STEP;
import org.alfresco.utility.data.AisToken;
import org.alfresco.utility.data.auth.DataAIS;
import org.alfresco.utility.model.UserModel;
import org.keycloak.authorization.client.util.HttpResponseException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class RestAisAuthentication
{
public static String STEP_PREFIX = "RestAisAuthProvider:";
public static String USER_DISABLED_MSG = "Account disabled";
@Autowired
private DataAIS dataAIS;
/**
*
* Get the AIS access token for the specified user model.
*
* @param userModel
* @return
*/
public String getAisAuthenticationToken(UserModel userModel)
{
STEP(String.format("%s Retrieving AIS authentication.", STEP_PREFIX));
AisToken aisToken = getAisAccessToken(userModel);
return aisToken.getToken();
}
/**
* Check if the Alfresco Identity Service is enabled
* @return True if Alfresco Identity Service is enabled (the identity service URL is not null or empty)
*/
public Boolean isAisAuthenticationEnabled()
{
return dataAIS.isEnabled() ? true : false;
}
/**
* Returns a valid access token for valid user credentials in userModel. An
* invalid access token is returned for invalid user credentials, which can
* be used for tests involving non existing or unauthorized users.
*
* @param userModel
* @return
*/
private AisToken getAisAccessToken(UserModel userModel)
{
String badToken = "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJUazFPZ2JqVlo1UEw2bmtsNWFvTUlacTZ4cW9PZzc5WGtzdnJTTUcxLUFZIn0.eyJqdGkiOiI3NTVkMGZiOS03NzI5LTQ1NzYtYWM4Ny1hZWZjZWNiZDE0ZGEiLCJleHAiOjE1NTM2MjQ1NDgsIm5iZiI6MCwiaWF0IjoxNTUzNjI0MjQ4LCJpc3MiOiJodHRwOi8vbG9jYWxob3N0L2F1dGgvcmVhbG1zL2FsZnJlc2NvIiwiYXVkIjoiYWNjb3VudCIsInN1YiI6Ijk4NDE0Njg4LTUwMDUtNDVmOS05YTVjLTlkMDRlODMyYTNkMiIsInR5cCI6IkJlYXJlciIsImF6cCI6ImFsZnJlc2NvIiwiYXV0aF90aW1lIjowLCJzZXNzaW9uX3N0YXRlIjoiNjJlN2U5YzktZmFlNS00N2RhLTk5MDItMTZjYTJhZWUwMWMwIiwiYWNyIjoiMSIsImFsbG93ZWQtb3JpZ2lucyI6WyJodHRwOi8vbG9jYWxob3N0KiIsImh0dHBzOi8vbG9jYWxob3N0KiJdLCJyZWFsbV9hY2Nlc3MiOnsicm9sZXMiOlsib2ZmbGluZV9hY2Nlc3MiLCJ1bWFfYXV0aG9yaXphdGlvbiJdfSwicmVzb3VyY2VfYWNjZXNzIjp7ImFjY291bnQiOnsicm9sZXMiOlsibWFuYWdlLWFjY291bnQiLCJtYW5hZ2UtYWNjb3VudC1saW5rcyIsInZpZXctcHJvZmlsZSJdfX0sInNjb3BlIjoicHJvZmlsZSBlbWFpbCIsImVtYWlsX3ZlcmlmaWVkIjpmYWxzZSwicHJlZmVycmVkX3VzZXJuYW1lIjoidXNlci12eGlrcXd3cG5jYmpzeHgifQ.PeLGCNCzj-P2m0knwUU9Vfx4dzLLQER9IdV7GyLel9LRN-3J9nh7GBDRQsyDJ0pqhObQyMg4V3wSsrsXRQ6gKhmUyDemmD-w1YMC2a2HKX6GlxsTEF_f1K_R15lIQOawNVErlWjZWORJGCvCYZOJ99SOmeOC6PGY79zLL94MMnf6dXcegePPMOKG-59eNjBkOylTipYebvM40nbbKrS5vzNHQlvUh4ALFeBoMSKGnLSjQd06Dj4SWojG0p1BrxurqDjW0zz6pQlEAm4vcWApRZ6qBLZcMH8adYix07zCDb87GOn1pmfEBWpwd3BEgC_LLu06guaCPHC9tpeIaDTHLg";
String badRefreshToken = "eyJhbGciOiJIUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJmM2YyMjhjYS1jMzg5LTQ5MGUtOGU1Zi02YWI1MmJhZDVjZGEifQ.eyJqdGkiOiIyNmExZWNhYy00Zjk0LTQwYzctYjJjNS04NTlhZmQ3NjBiYWMiLCJleHAiOjE1NTM2MjYwNDgsIm5iZiI6MCwiaWF0IjoxNTUzNjI0MjQ4LCJpc3MiOiJodHRwOi8vbG9jYWxob3N0L2F1dGgvcmVhbG1zL2FsZnJlc2NvIiwiYXVkIjoiaHR0cDovL2xvY2FsaG9zdC9hdXRoL3JlYWxtcy9hbGZyZXNjbyIsInN1YiI6Ijk4NDE0Njg4LTUwMDUtNDVmOS05YTVjLTlkMDRlODMyYTNkMiIsInR5cCI6IlJlZnJlc2giLCJhenAiOiJhbGZyZXNjbyIsImF1dGhfdGltZSI6MCwic2Vzc2lvbl9zdGF0ZSI6IjYyZTdlOWM5LWZhZTUtNDdkYS05OTAyLTE2Y2EyYWVlMDFjMCIsInJlYWxtX2FjY2VzcyI6eyJyb2xlcyI6WyJvZmZsaW5lX2FjY2VzcyIsInVtYV9hdXRob3JpemF0aW9uIl19LCJyZXNvdXJjZV9hY2Nlc3MiOnsiYWNjb3VudCI6eyJyb2xlcyI6WyJtYW5hZ2UtYWNjb3VudCIsIm1hbmFnZS1hY2NvdW50LWxpbmtzIiwidmlldy1wcm9maWxlIl19fSwic2NvcGUiOiJwcm9maWxlIGVtYWlsIn0.lRBJQc7tj0rk7JBC0zpM0dDdZgDKjm9wcxP8nzLnXe4";
AisToken aisToken;
try
{
// Attempt to get an access token for userModel from AIS
aisToken = dataAIS.perform().getAccessToken(userModel);
}
catch (HttpResponseException e)
{
// Trying to authenticate with invalid user credentials or disabled
// user so return an invalid access token
String httpResponse = new String(e.getBytes());
if (e.getStatusCode() == 401 || httpResponse.contains(USER_DISABLED_MSG))
{
STEP(String.format("%s User disabled or invalid user credentials were provided %s:%s. Using invalid token for request.", STEP_PREFIX,
userModel.getUsername(), userModel.getPassword()));
aisToken = new AisToken(badToken, badRefreshToken, System.currentTimeMillis(), 300000);
}
else
{
throw e;
}
}
return aisToken;
}
}

View File

@@ -0,0 +1,162 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.core;
import static org.alfresco.utility.report.log.Step.STEP;
import java.util.List;
import java.util.Random;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.core.assertion.IModelsCollectionAssertion;
import org.alfresco.rest.core.assertion.ModelsCollectionAssertion;
import org.alfresco.rest.exception.EmptyRestModelCollectionException;
import org.alfresco.rest.model.RestPaginationModel;
import org.alfresco.rest.model.RestSiteModelsCollection;
/**
* Map multiple entries of JSON response to a class <T>
*
* Example:
*
* "entries": [
{
"entry": {
"visibility": "PUBLIC",
"guid": "79e140e1-5039-4efa-acaf-c22b5ba7c947",
"description": "Description1470255221170",
"id": "0-C2291-1470255221170",
"title": "0-C2291-1470255221170"
}
},
*
* Having this JSON Entry, we can auto-map this to {@link RestSiteModelsCollection} class having a List of <SiteModel> based on this example
*
* @author Paul Brodner
*/
public abstract class RestModels<Model, ModelCollection> implements IRestModelsCollection<Model>, IModelsCollectionAssertion<ModelCollection>
{
@JsonProperty(value = "entries")
private List<Model> modelEntries;
private RestPaginationModel pagination;
@Override
public List<Model> getEntries()
{
return modelEntries;
}
/**
* @return a random entry from entries list
* @throws EmptyRestModelCollectionException
*/
@Override
public Model getOneRandomEntry() throws EmptyRestModelCollectionException
{
STEP("REST API: Get random one entry from response");
Random random = new Random();
List<Model> models = getEntries();
if(models.isEmpty())
throw new EmptyRestModelCollectionException(models);
int index = random.nextInt(models.size());
return models.get(index);
}
/**
* Example
* <code>
* siteMembershipRequests.getEntryByIndex(0)
.assertThat().field("site.visibility").is(moderatedSite.getVisibility())
.assertThat().field("site.description").is(moderatedSite.getDescription())
.assertThat().field("site.id").is(moderatedSite.getId())
.assertThat().field("site.title").is(moderatedSite.getTitle());
* </code>
* @param index
* @return
* @throws EmptyRestModelCollectionException
*/
@SuppressWarnings("unchecked")
public Model getEntryByIndex(int index) throws EmptyRestModelCollectionException{
STEP("REST API: Get index entry from response");
List<Model> models = getEntries();
if(models.isEmpty())
throw new EmptyRestModelCollectionException(models);
if(models.size() > index){
return (Model) ((IRestModel<?>)models.get(index)).onModel();
}
return null;
}
@Override
public ModelsCollectionAssertion<RestModels<Model, ModelCollection>> assertThat()
{
return new ModelsCollectionAssertion<>(this);
}
@Override
public ModelsCollectionAssertion<RestModels<Model, ModelCollection>> and()
{
return assertThat();
}
@SuppressWarnings("unchecked")
@Override
public ModelCollection when()
{
return (ModelCollection)this;
}
/**
* @return boolean value if entry is empty
*/
@Override
public boolean isEmpty()
{
if (getEntries() != null)
return getEntries().isEmpty();
else
return true;
}
@Override
public RestPaginationModel getPagination()
{
return pagination;
}
public void setPagination(RestPaginationModel pagination)
{
this.pagination = pagination;
}
}

View File

@@ -0,0 +1,45 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.core;
import org.alfresco.utility.TasProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
@Configuration
@PropertySource("classpath:default.properties")
@PropertySource(value = "classpath:${environment}.properties", ignoreResourceNotFound = true)
public class RestProperties
{
@Autowired
private TasProperties properties;
public TasProperties envProperty()
{
return properties;
}
}

View File

@@ -0,0 +1,216 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.core;
import static org.alfresco.utility.report.log.Step.STEP;
import java.util.MissingFormatArgumentException;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import io.restassured.RestAssured;
import org.springframework.http.HttpMethod;
/**
* @author Paul Brodner
*/
public class RestRequest
{
private static final String TOKEN_REGEX = "\\{.*?}";
private String body;
private HttpMethod httpMethod;
private String path;
private Object[] pathParams;
private String contentType = "UTF-8";
private RestRequest(HttpMethod httpMethod, String path, String... pathParams)
{
this(httpMethod, "", path, pathParams);
}
private RestRequest(HttpMethod httpMethod, String body, String path, String... pathParams)
{
setHttpMethod(httpMethod);
setPath(path);
setPathParams(pathParams);
setBody(body);
// Validate that the supplied path and pathParams are compatible.
constructPath();
}
/**
* Use this request when no body is needed
*
* @param httpMethod
* @param path
* @param pathParams
* @return
*/
public static RestRequest simpleRequest(HttpMethod httpMethod, String path, String... pathParams)
{
return new RestRequest(httpMethod, path, pathParams);
}
/**
* Use this request when a body has to be provided
*
* @param httpMethod
* @param body
* @param path
* @param pathParams
* @return
*/
public static RestRequest requestWithBody(HttpMethod httpMethod, String body, String path, String... pathParams)
{
return new RestRequest(httpMethod, body, path, pathParams);
}
public String getBody()
{
return body;
}
public void setBody(String body)
{
this.body = body;
}
public HttpMethod getHttpMethod()
{
return httpMethod;
}
public void setHttpMethod(HttpMethod httpMethod)
{
this.httpMethod = httpMethod;
}
public String getPath()
{
return path;
}
public void setPath(String path)
{
this.path = path;
addQueryParamsIfNeeded();
}
public Object[] getPathParams()
{
return pathParams;
}
public void setPathParams(Object[] pathParams)
{
this.pathParams = pathParams;
addQueryParamsIfNeeded();
}
/**
* Add query parameters to the path if needed.
* <p>
* e.g. For a path of "api/{fruit}" and params ["apple", "size=10", "colour=red"] then this will
* update the path to be "api/{fruit}?{param0}&{param1}" so that the tokens will be populated by
* RestAssured to make "api/apple?size=10&colour=red".
*/
private void addQueryParamsIfNeeded()
{
// Don't do anything if the path or path params haven't been set yet.
if (path == null || path.length() == 0 || pathParams == null)
{
return;
}
int groupCount = (int) Pattern.compile(TOKEN_REGEX).matcher(path).results().count();
if (pathParams.length > groupCount)
{
// Add the remaining parameters to the URL query.
String queryParams = IntStream.range(0, pathParams.length - groupCount)
.mapToObj(index -> "{parameter" + index + "}")
.collect(Collectors.joining("&"));
path += (path.contains("?") ? "&" : "?") + queryParams;
}
}
public String getContentType()
{
return contentType;
}
public void setContentType(String contentType)
{
this.contentType = contentType;
}
/**
* {@inheritDoc}
* @throws MissingFormatArgumentException If there are not enough pathParams for the path.
*/
@Override
public String toString()
{
StringBuilder sb = new StringBuilder()
.append("Request: ")
.append(getHttpMethod())
.append(" ")
.append(RestAssured.baseURI)
.append(":")
.append(RestAssured.port)
.append("/")
.append(RestAssured.basePath)
.append("/");
sb.append(constructPath());
if(!getBody().isEmpty())
{
sb.append("\nbody:")
.append(getBody());
}
sb.append("\n");
return sb.toString();
}
/**
* Populate the path with the pathParams.
*
* @return The path with tokens replaced with values.
* @throws MissingFormatArgumentException If there are not enough pathParams for the path.
*/
private String constructPath()
{
String getPathFormatted = getPath();
if(getPath().contains("{"))
{
getPathFormatted = getPath().replaceAll(TOKEN_REGEX, "%s");
getPathFormatted = String.format(getPathFormatted, getPathParams());
}
return getPathFormatted;
}
}

View File

@@ -0,0 +1,71 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.core;
import io.restassured.response.Response;
import io.restassured.response.ValidatableResponse;
/**
* Defines a Rest Response
*
* @author Paul Brodner
*/
public class RestResponse
{
private Response response;
public RestResponse(Response response)
{
this.setResponse(response);
}
public String getStatusCode()
{
return String.valueOf(response.getStatusCode());
}
public Response getResponse()
{
return response;
}
public void setResponse(Response response)
{
this.response = response;
}
public <T> T toModel(Class<T> classz)
{
return response.as(classz);
}
public ValidatableResponse assertThat()
{
return response.then();
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,39 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.core.assertion;
public interface IModelAssertion<Model>
{
default ModelAssertion<Model> assertThat()
{
return new ModelAssertion<>(this);
}
default ModelAssertion<Model> and()
{
return assertThat();
}
}

View File

@@ -0,0 +1,39 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.core.assertion;
@SuppressWarnings("rawtypes")
public interface IModelsCollectionAssertion<ModelCollection> {
public ModelsCollectionAssertion and();
public ModelsCollectionAssertion assertThat();
@SuppressWarnings("unchecked")
default ModelCollection when()
{
return (ModelCollection) this;
}
}

View File

@@ -0,0 +1,435 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.core.assertion;
import java.io.Serializable;
import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject;
import com.google.gson.TypeAdapter;
import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import io.restassured.path.json.JsonPath;
import org.alfresco.utility.exception.TestConfigurationException;
import org.alfresco.utility.model.TestModel;
import org.testng.Assert;
/**
* Assertion on Rest Model
* Just pass your rest model as constructor
*
* @author Paul Brodner
*/
public class ModelAssertion<T>
{
protected static void checkFieldIsPresent(Object fieldNameToBeRetuned, Object fieldValueToBeRetuned)
{
if (fieldValueToBeRetuned == null)
{
Assert.fail(String.format("Field {%s} was not found in returned response.",fieldNameToBeRetuned));
}
}
private final Object model;
public ModelAssertion(Object model)
{
this.model = model;
}
/**
* Use this DSL for asserting particular fields of your model if your model
* is like this (basic POJO)
* public class Person extends ModelAssertion<Person>
* { private String id = "1234"; }
* you can use assert the id of this person as:
* Person p = new Person(); p.assertThat().field("id").is("1234")
*
* @param fieldName
* @return
* @throws IllegalStateException If the field cannot be converted to JSON.
*/
public AssertionVerbs field(String fieldName)
{
ObjectMapper mapper = new ObjectMapper();
String jsonInString = null;
try
{
jsonInString = mapper.writeValueAsString(model);
}
catch (JsonProcessingException e)
{
throw new IllegalStateException(e);
}
Object fieldValue = JsonPath.with(jsonInString).get(fieldName);
return new AssertionVerbs(model, fieldValue, fieldName);
}
public AssertionItemVerbs fieldsCount()
{
int actualSize = 0;
List<Field> allFields = getAllDeclaredFields(new LinkedList<Field>(), model.getClass());
for (Field field : allFields)
{
field.setAccessible(true);
Object fieldValue = null;
try
{
fieldValue = field.get(model);
}
catch (IllegalAccessException e)
{
throw new IllegalStateException("Unable to load model using reflection.", e);
}
if (fieldValue != null)
actualSize++;
}
return new AssertionItemVerbs(model, actualSize);
}
/**
* Use this method for asserting whole model with different model object. Method allows to ignore particular fields during the comparison.
*
* WARNING: For proper work model should implement {@code toString()} and {@code equals()} methods.
*
* @param expected - expected model.
* @param ignoreFields - fields which should be ignored during assertion.
* @return model.
*/
@SuppressWarnings("unchecked")
public T isEqualTo(T expected, String... ignoreFields)
{
T modelCopy = createCopyIgnoringFields((T) model, ignoreFields);
T expectedCopy = createCopyIgnoringFields(expected, ignoreFields);
Assert.assertEquals(modelCopy, expectedCopy, String.format("Compared objects of type: %s are not equal!", model.getClass()));
return (T) model;
}
/**
* Get all fields declared from all classes hierarchy
*
* @param fields
* @param classz
* @return
*/
private List<Field> getAllDeclaredFields(List<Field> fields, Class<?> classz)
{
if (classz.isAssignableFrom(TestModel.class))
{
return fields;
}
fields.addAll(Arrays.asList(classz.getDeclaredFields()));
if (classz.getSuperclass() != null)
{
fields = getAllDeclaredFields(fields, classz.getSuperclass());
}
return fields;
}
@SuppressWarnings("unchecked")
private T createCopyIgnoringFields(T model, String... ignoreFields)
{
GsonBuilder gsonBuilder = new GsonBuilder();
gsonBuilder.registerTypeAdapterFactory(new SerializableTypeAdapterFactory());
Gson gson = gsonBuilder.create();
JsonObject jsonObject = gson.fromJson(gson.toJson(model), JsonObject.class);
for (String ignoreField : ignoreFields)
{
jsonObject.remove(ignoreField);
}
return gson.fromJson(gson.toJson(jsonObject), (Class<? extends T>) model.getClass());
}
/** Workaround from https://github.com/google/gson/issues/544 */
private class SerializableTypeAdapterFactory implements TypeAdapterFactory
{
@Override
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type)
{
if (Serializable.class.equals(type.getRawType()))
{
return (TypeAdapter<T>) gson.getAdapter(Object.class);
}
return null;
}
}
/**
* DSL assertion on Rest Model fields
*
* @author Paul Brodner
*/
@SuppressWarnings("unchecked")
public class AssertionVerbs
{
private String fieldName;
private Object model;
private Object fieldValue;
public AssertionVerbs(Object model, Object fieldValue, String fieldName)
{
this.model = model;
this.fieldValue = fieldValue;
this.fieldName = fieldName;
}
private String errorMessage(String info)
{
return String.format("The value of field [%s -> from %s] %s", fieldName, model.getClass().getCanonicalName(), info);
}
public T isNot(Object expected)
{
checkFieldIsPresent(fieldName, fieldValue);
Assert.assertNotEquals(fieldValue, expected, errorMessage("is correct,"));
return (T) model;
}
@Override
public boolean equals(Object o)
{
throw new UnsupportedOperationException("You probably want to use is() rather than equals()");
}
public T is(Object expected)
{
checkFieldIsPresent(fieldName, fieldValue);
Assert.assertEquals(fieldValue.toString(), expected.toString(), errorMessage("is NOT correct,"));
return (T) model;
}
/**
* Check if the supplied field is a non-empty String, Collection or Map.
*
* @throws AssertionError if the field is empty.
* @throws UnsupportedOperationException if the field cannot be checked for emptiness.
*/
public T isNotEmpty()
{
checkFieldIsPresent(fieldName, fieldValue);
if (fieldValue instanceof Collection)
{
Assert.assertNotEquals(fieldValue, Collections.emptyList(), errorMessage("is empty,"));
}
else if (fieldValue instanceof String)
{
Assert.assertNotEquals(fieldValue, "", errorMessage("is empty,"));
}
else if (fieldValue instanceof Map)
{
Assert.assertNotEquals(fieldValue, Collections.emptyMap(), errorMessage("is empty,"));
}
else if (fieldValue instanceof Integer)
{
Assert.assertNotEquals(fieldValue.toString(), "", errorMessage("is empty,"));
}
else if (fieldValue instanceof Long)
{
Assert.assertNotEquals(fieldValue.toString(), "", errorMessage("is empty,"));
}
else if (fieldValue instanceof Boolean)
{
Assert.assertNotEquals(String.valueOf(fieldValue), "", errorMessage("is empty,"));
}
else
{
throw new UnsupportedOperationException("Cannot check for emptiness of " + fieldValue.getClass());
}
return (T) model;
}
public T isNotNull()
{
checkFieldIsPresent(fieldName, fieldValue);
Assert.assertNotNull(fieldValue, errorMessage("is null,"));
return (T) model;
}
public T isNull()
{
Assert.assertNull(fieldValue, errorMessage("is not null,"));
return (T) model;
}
/**
* Check if the supplied field is an empty String, Collection or Map.
*
* @throws AssertionError if the field is not empty.
* @throws UnsupportedOperationException if the field cannot be checked for emptiness.
*/
public T isEmpty()
{
checkFieldIsPresent(fieldName, fieldValue);
if (fieldValue instanceof Collection)
{
Assert.assertEquals((Collection<?>) fieldValue, Collections.emptyList(), errorMessage("is NOT empty,"));
}
else if (fieldValue instanceof String)
{
Assert.assertEquals(fieldValue, "", errorMessage("is NOT empty,"));
}
else if (fieldValue instanceof Map)
{
Assert.assertEquals(fieldValue, Collections.emptyMap(), errorMessage("is NOT empty,"));
}
else
{
throw new UnsupportedOperationException("Cannot check for emptiness of " + fieldValue.getClass());
}
return (T) model;
}
public T contains(String value)
{
if (!fieldValue.toString().contains(value))
{
Assert.fail(errorMessage("does NOT contain expected value: " + value + ", Current Value: " + fieldValue.toString()));
}
return (T) model;
}
public T notContains(String value)
{
if (fieldValue.toString().contains(value))
{
Assert.fail(errorMessage("does contain unexpected value: " + value + ", Current Value: " + fieldValue.toString()));
}
return (T) model;
}
/**
* Assert if predicate value is greater than the field value
* @author Michael Suzuki
* @param value the predicate
* @return
* @throws TestConfigurationException
*
*/
public T isGreaterThan(Integer value) throws TestConfigurationException
{
return validateSize(value, Operation.Greater);
}
private T validateSize(Integer value, Operation operation) throws TestConfigurationException
{
try
{
if(value == null)
{
throw new TestConfigurationException("Input must be valid");
}
Integer b = Integer.valueOf(fieldValue.toString());
switch (operation)
{
case Greater:
if(value > b)
{
Assert.fail(errorMessage(String.format("The expected value %s is not greater than the actual value %s ",
value, fieldValue.toString())));
}
break;
case Less:
if(value < b)
{
Assert.fail(errorMessage(String.format("The expected value %s is not less than the actual value %s ",
value, fieldValue.toString())));
}
break;
default:
Assert.fail(errorMessage("No operation type provided"));
break;
}
}
catch(NumberFormatException e)
{
Assert.fail(errorMessage("The field is not numeric " + fieldValue.toString()));
}
catch (NullPointerException ne)
{
Assert.fail(errorMessage("The input value must be numeric " + value));
}
return (T) model;
}
/**
* Assert if predicate value is less than the field value
* @author Michael Suzuki
* @param value the predicate
* @return
* @throws TestConfigurationException
*
*/
public T isLessThan(Integer value) throws TestConfigurationException
{
return validateSize(value, Operation.Less);
}
}
@SuppressWarnings("unchecked")
public class AssertionItemVerbs
{
private Object model;
private Object actual;
public AssertionItemVerbs(Object model, Object actual)
{
this.model = model;
this.actual = actual;
}
public T is(Object expected) {
Assert.assertEquals(actual, expected, String.format("For model [%s], the expected value is not correct ",
model.getClass().getSimpleName(), expected.toString(), actual.toString()));
return (T) model;
}
}
public static enum Operation
{
Less,Greater
}
}

View File

@@ -0,0 +1,279 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.core.assertion;
import static org.alfresco.utility.report.log.Step.STEP;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import org.alfresco.rest.core.IRestModelsCollection;
import org.alfresco.utility.exception.TestConfigurationException;
import org.alfresco.utility.model.Model;
import org.apache.commons.beanutils.BeanUtils;
import org.testng.Assert;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.Ordering;
import io.restassured.path.json.JsonPath;
/**
* Assertion on Rest Model Collection
* Just pass your rest model collection as constructor
*
* @author Paul Brodner
*/
public class ModelsCollectionAssertion<C>
{
@SuppressWarnings("rawtypes")
private IRestModelsCollection modelCollection;
@SuppressWarnings("rawtypes")
public ModelsCollectionAssertion(IRestModelsCollection modelCollection)
{
this.modelCollection = modelCollection;
}
/**
* check if "entries" list from JSON is not empty
*/
@SuppressWarnings("unchecked")
public C entriesListIsNotEmpty()
{
STEP("REST API: Assert that entries list from response is not empty");
Assert.assertFalse(modelCollection.isEmpty(), "Entries list from response is empty.Check the logs for more details!");
return (C) modelCollection;
}
/**
* check if "entries" list from JSON is empty
*/
@SuppressWarnings("unchecked")
public C entriesListIsEmpty()
{
STEP("REST API: Assert that entries list from response is empty");
Assert.assertTrue(modelCollection.isEmpty(), "Entries list from response is not empty.Check the logs for more details!");
return (C) modelCollection;
}
@SuppressWarnings("unchecked")
public C entriesListCountIs(int expectedCount)
{
STEP(String.format("REST API: Assert that entries list count is %d", expectedCount));
int actualSize = modelCollection.getEntries().size();
Assert.assertEquals(actualSize, expectedCount);
return (C) modelCollection;
}
@SuppressWarnings("unchecked")
public C entriesListContains(String key, String value)
{
List<Model> modelEntries = modelCollection.getEntries();
String fieldValue = "";
for (Model m : modelEntries) {
Object model = loadModel(m);
try {
ObjectMapper mapper = new ObjectMapper();
String jsonInString = mapper.writeValueAsString(model);
fieldValue = JsonPath.with(jsonInString).get(key);
if (fieldValue != null && fieldValue.equals(value)) {
break;
}
} catch (Exception e) {
throw new TestConfigurationException(String.format(
"You try to assert field [%s] that doesn't exist in class: [%s]. Exception: %s, Please check your code!",
key, getClass().getCanonicalName(), e.getMessage()));
}
}
Assert.assertEquals(fieldValue, value, String.format("Entry with key: [%s] with value [%s] not found in list", key, value));
return (C) modelCollection;
}
@SuppressWarnings("unchecked")
public C entriesListDoesNotContain(String key, String value)
{
boolean exist = false;
List<Model> modelEntries = modelCollection.getEntries();
for (Model m : modelEntries) {
Object model = loadModel(m);
String fieldValue = "";
try {
ObjectMapper mapper = new ObjectMapper();
String jsonInString = mapper.writeValueAsString(model);
fieldValue = JsonPath.with(jsonInString).get(key);
if (fieldValue != null && fieldValue.equals(value)) {
exist = true;
break;
}
} catch (Exception e) {
// nothing to do
}
}
Assert.assertFalse(exist,
String.format("Entry with key: %s and value %s was found in list", key, value));
return (C) modelCollection;
}
@SuppressWarnings("unchecked")
public C entriesListDoesNotContain(String key)
{
boolean exist = modelInList(key);
Assert.assertFalse(exist,
String.format("Entry list contains key: %s", key));
return (C) modelCollection;
}
@SuppressWarnings("unchecked")
public C entriesListContains(String key)
{
boolean exist = modelInList(key);
Assert.assertTrue(exist,
String.format("Entry list doesn't contain key: %s", key));
return (C) modelCollection;
}
private boolean modelInList(String key)
{
List<Model> modelEntries = modelCollection.getEntries();
for (Model m : modelEntries)
{
Object model = loadModel(m);
ObjectMapper mapper = new ObjectMapper();
String jsonInString;
try
{
jsonInString = mapper.writeValueAsString(model);
}
catch (JsonProcessingException e)
{
throw new IllegalStateException("Failed to convert model to string.", e);
}
Object fieldValue = JsonPath.with(jsonInString).get(key);
if (fieldValue != null)
{
return true;
}
}
return false;
}
@SuppressWarnings("unchecked")
public C paginationExist()
{
STEP("REST API: Assert that response has pagination");
Assert.assertNotNull(modelCollection.getPagination(), "Pagination is was not found in the response");
return (C) modelCollection;
}
/**
* Check one field from pagination json body
*
* @param field
* @return
*/
@SuppressWarnings("rawtypes")
public PaginationAssertionVerbs paginationField(String field)
{
return new PaginationAssertionVerbs<C>(modelCollection, field, modelCollection.getPagination());
}
/**
* check is the entries are ordered ASC by a specific field
*
* @param field from json response
* @return
*/
@SuppressWarnings("unchecked")
public C entriesListIsSortedAscBy(String field)
{
List<Model> modelEntries = modelCollection.getEntries();
List<String> fieldValues = new ArrayList<String>();
for(Model m: modelEntries)
{
Object model = loadModel(m);
String fieldValue = "";
try {
fieldValue = BeanUtils.getProperty(model, field);
fieldValues.add(fieldValue);
}
catch (Exception e)
{
// nothing to do
}
}
Assert.assertTrue(Ordering.natural().isOrdered(fieldValues), String.format("Entries are not ordered ASC by %s", field));
return (C) modelCollection;
}
/**
* check is the entries are ordered DESC by a specific field
*
* @param field from json response
* @return
*/
@SuppressWarnings("unchecked")
public C entriesListIsSortedDescBy(String field)
{
List<Model> modelEntries = modelCollection.getEntries();
List<String> fieldValues = new ArrayList<String>();
for(Model m: modelEntries)
{
Object model = loadModel(m);
String fieldValue = "";
try {
fieldValue = BeanUtils.getProperty(model, field);
fieldValues.add(fieldValue);
}
catch (Exception e)
{
// nothing to do
}
}
Assert.assertTrue(Ordering.natural().reverse().isOrdered(fieldValues), String.format("Entries are not ordered DESC by %s", field));
return (C) modelCollection;
}
private Object loadModel(Model m)
{
try
{
Method method = m.getClass().getMethod("onModel", new Class[] {});
return method.invoke(m, new Object[] {});
}
catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e)
{
throw new IllegalStateException("Failed to load model using reflection.", e);
}
}
}

View File

@@ -0,0 +1,104 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.core.assertion;
import org.alfresco.rest.core.IRestModelsCollection;
import org.alfresco.rest.model.RestPaginationModel;
import org.alfresco.utility.exception.TestConfigurationException;
import org.apache.commons.beanutils.BeanUtils;
import org.testng.Assert;
/**
* Pagination related assertions
*
* @author Paul Brodner
*/
public class PaginationAssertionVerbs<C> {
private RestPaginationModel pagination;
private C modelCollection;
private String fieldName;
@SuppressWarnings({ "rawtypes", "unchecked" })
public PaginationAssertionVerbs(IRestModelsCollection modelCollection, String fieldName, RestPaginationModel pagination) {
this.modelCollection = (C)modelCollection;
this.fieldName = fieldName;
this.pagination = pagination;
}
/**
* @return the value of the field
*/
private String getFieldValue() {
String value = "";
try {
value = BeanUtils.getProperty(pagination, fieldName);
} catch (Exception e) {
throw new TestConfigurationException(String.format(
"You try to assert field [%s] that doesn't exist in class: [%s]. Exception: %s, Please check your code!",
fieldName, modelCollection.getClass().getCanonicalName(), e.getMessage()));
}
return value;
}
private String errorMessage(String info) {
return String.format("The value of field [%s -> from %s] %s", fieldName,
modelCollection.getClass().getCanonicalName(), info);
}
public C is(String expected) {
Assert.assertEquals(getFieldValue(), expected, errorMessage("is NOT correct,"));
return modelCollection;
}
public C isNot(Object expected) {
Assert.assertNotEquals(getFieldValue(), expected, errorMessage("is correct,"));
return modelCollection;
}
public C isNotEmpty() {
Assert.assertNotEquals(getFieldValue(), "", errorMessage("is empty,"));
return modelCollection;
}
public C isNotNull() {
Assert.assertNotNull(getFieldValue(), errorMessage("is null,"));
return modelCollection;
}
public C isNotPresent() {
Assert.assertNull(getFieldValue(), errorMessage("is present,"));
return modelCollection;
}
public C isEmpty() {
Assert.assertEquals(getFieldValue(), "", errorMessage("is NOT empty,"));
return modelCollection;
}
}

View File

@@ -0,0 +1,76 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.core.swagger;
/**
* Executed via command line/terminal from root of this project
* Just execute <code>mvn exec:java</code> passing as arguments:
* -Dcoverage => this will show on screen the actual coverage of TAS (vs requests that exists in each YAML file - defined in pom.xml)
* -Dmodels => this will show all MISSING models that are NOT already implemented in TAS.
* -Dmodels=a,b,d => this will generate ONLY the models 'a', 'b' and 'd' passed as parameter
* -Dhelp => show help
*
* @author Paul Brodner
*/
public class Generator
{
public static String line = "********\n------------------------------------------------------------------------";
public static void main(String[] args)
{
if (!System.getProperties().containsKey("coverage") && !System.getProperties().containsKey("models") || System.getProperties().containsKey("help") )
{
System.out.println(line);
System.out.println("No parameters provided, please use the following values:\n");
System.out.println(
"mvn exec:java -Dcoverage => this will show on screen the actual coverage of TAS (vs requests that exists in each YAML file - defined in pom.xml).");
System.out.println("mvn exec:java -Dmodels => this will show all MISSING models that are NOT already implemented in TAS.");
System.out.println("mvn exec:java -Dmodels=a,b,d => this will generate ONLY the models 'a', 'b' and 'd' passed as parameter.");
System.out.println(line);
}
for (String url : args)
{
if (System.getProperty("coverage") != null)
{
/*
* <code>mvn exec:java -Dcoverage</code>
*/
new SwaggerYamlParser(url).computeCoverage();
}
else if (System.getProperty("models") != null)
{
/*
* <code>mvn exec:java -Dmodels</code>
* <code>mvn exec:java -Dmodels=a,c,e</code>
*/
new SwaggerYamlParser(url).generateMissingModules();
}
}
}
}

View File

@@ -0,0 +1,150 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.core.swagger;
import java.util.AbstractMap;
import java.util.Map.Entry;
import io.swagger.models.properties.ArrayProperty;
import io.swagger.models.properties.RefProperty;
/**
* Model property used by freemarker template in {@link SwaggerModel}
*
*/
public class RestModelProperty
{
private String name;
private String type;
private String description;
private Boolean isRequired = false;
/** If the property is a ref then this is the type referenced. */
private String simpleRef;
/** If the property is an array then this is the type of the items in it. */
private RestModelProperty itemsType;
public static RestModelProperty build(Entry<String, io.swagger.models.properties.Property> property)
{
RestModelProperty model = new RestModelProperty();
model.setName(property.getKey());
model.setType(property.getValue().getType());
model.setDescription(property.getValue().getDescription());
model.setIsRequired(property.getValue().getRequired());
if (property.getValue() instanceof RefProperty)
{
RefProperty refProperty = (RefProperty) property.getValue();
model.setSimpleRef(refProperty.getSimpleRef());
}
if (property.getValue() instanceof ArrayProperty)
{
ArrayProperty arrayProperty = (ArrayProperty) property.getValue();
Entry<String, io.swagger.models.properties.Property> itemsEntry = new AbstractMap.SimpleEntry<String, io.swagger.models.properties.Property>(
arrayProperty.getName(), arrayProperty.getItems());
model.setItemsType(RestModelProperty.build(itemsEntry));
}
return model;
}
public String getName()
{
return name;
}
public String getNameCapitalized()
{
return org.apache.commons.lang3.StringUtils.capitalize(name);
}
public void setName(String name)
{
this.name = name;
}
public String getType()
{
switch (this.type)
{
case "string":
return "String";
case "integer":
return "int";
case "object":
return "Object";
case "ref":
return "Rest" + getSimpleRef() + "Model";
case "array":
return "List<" + getItemsType().getType() + ">";
default:
return type;
}
}
public void setType(String type)
{
this.type = type;
}
public String getDescription()
{
return description;
}
public void setDescription(String description)
{
this.description = description;
}
public Boolean isRequired()
{
return isRequired;
}
public void setIsRequired(Boolean isRequired)
{
this.isRequired = isRequired;
}
protected void setSimpleRef(String simpleRef)
{
this.simpleRef = simpleRef;
}
public String getSimpleRef()
{
return simpleRef;
}
protected void setItemsType(RestModelProperty itemsType)
{
this.itemsType = itemsType;
}
public RestModelProperty getItemsType()
{
return itemsType;
}
}

View File

@@ -0,0 +1,222 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.core.swagger;
import java.io.BufferedReader;
import java.io.Console;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import java.util.Map.Entry;
import org.alfresco.utility.exception.TestConfigurationException;
import freemarker.template.TemplateException;
import io.swagger.models.Model;
import io.swagger.models.Swagger;
/**
* Handles all
* <code>Entry<String, Model> model : swagger.getDefinitions().entrySet()</code>
*
* @author Paul Brodner
*/
public class SwaggerDefinitions
{
private Swagger swagger;
List<SwaggerModel> missingSwaggerModels = new ArrayList<SwaggerModel>();
Path modelsPath;
public SwaggerDefinitions(Swagger swagger)
{
this.swagger = swagger;
modelsPath = Paths.get(Paths.get(".").toAbsolutePath().normalize().toFile().getPath(), "src/main/java/org/alfresco/rest/model");
}
public void generateMissingDefinitions()
{
/*
* read the content of ignore-moldels file
*/
List<String> ignoreModel = new ArrayList<String>();
try
{
try (BufferedReader br = new BufferedReader(new FileReader(Paths.get(modelsPath.toFile().getPath(), "ignore-models").toFile())))
{
String line;
while ((line = br.readLine()) != null)
{
if (!line.startsWith("#") && !line.equals(""))
ignoreModel.add(line);
}
}
}
catch (IOException e)
{
throw new IllegalStateException("Exception while generating missing definitions.", e);
}
/*
* filter all models, ignoring the ones from ignore-model or the ones that are already created locally
*/
for (Entry<String, Model> model : swagger.getDefinitions().entrySet())
{
SwaggerModel swaggerModel = new SwaggerModel(model, swagger);
//regexp
if(swaggerModel.getName().matches(".*Paging|.*Entry"))
{
System.out.printf("Ignoring Model: [%s] (based on regular expression: '.*Paging|.*Entry')\n", swaggerModel.getName());
continue;
}
if (ignoreModel.contains(swaggerModel.getName()))
{
System.out.printf("Ignoring Model: [%s] (based on 'ignore-models' file)\n", swaggerModel.getName());
continue;
}
if (!swaggerModel.exist())
missingSwaggerModels.add(swaggerModel);
}
System.out.println(Generator.line);
int count = 0;
/*
* iterate on all missing models
*/
for (SwaggerModel swaggerModel : missingSwaggerModels)
{
if (count == 0) // table heather
{
System.out.printf("MISSING MODEL ~ THE NEW FILE THAT WILL BE GENERATED\n");
System.out.println(" 0 -[Skip all]");
}
count += 1;
StringBuilder info = new StringBuilder();
info.append(" ")
.append(count)
.append(" -")
.append("[")
.append(swaggerModel.getName())
.append("] ~ [")
.append(swaggerModel.getPath())
.append("]");
System.out.println(info.toString());
}
System.out.println("ENTER -[All Models]");
/*
* wait for input
*/
Console c = System.console();
if (c != null && missingSwaggerModels.size() > 0)
{
c.format("%s\n", Generator.line);
c.format("\nPlease select what Models you want to generate (ex: 1,3,4) or press <<ENTER>>to generating all missing models:");
String prompt = c.readLine();
if(prompt.equals("0"))
return;
if (prompt.length() == 0)
{
System.out.println("\nStart generating all models...");
for (SwaggerModel swaggerModel : missingSwaggerModels)
{
generateModel(swaggerModel);
}
}
else
{
if (prompt.contains(","))
{
String[] modelsIDToGen = prompt.split(",");
for (int i = 0; i < modelsIDToGen.length; i++)
{
generateSelectedSwaggerModel(modelsIDToGen[i]);
}
}
else
{
generateSelectedSwaggerModel(prompt);
}
}
}
}
/**
* Generate the model based on the ID provided
*
* @param id
*/
private void generateSelectedSwaggerModel(String id)
{
int choice = Integer.parseInt(id);
if ((choice - 1) >= missingSwaggerModels.size())
{
throw new TestConfigurationException(
"You specified a wrong ID: [" + id + "] please select one value from the list displayed above. Run the command again!");
}
generateModel(missingSwaggerModels.get(choice - 1));
}
public boolean generateDefinition(String modelParamValue)
{
for (Entry<String, Model> model : swagger.getDefinitions().entrySet())
{
SwaggerModel swaggerModel = new SwaggerModel(model, swagger);
if (swaggerModel.getName().equals(modelParamValue))
{
generateModel(swaggerModel);
return true;
}
}
System.err.println("Model that you provided was NOT found!");
System.err.printf("Model [%s] not found in Swagger file: %s\n", modelParamValue, swagger.getBasePath());
return false;
}
private void generateModel(SwaggerModel swaggerModel)
{
try
{
swaggerModel.generate();
}
catch (IOException | TemplateException e)
{
throw new IllegalStateException("Exception while generating model definition.", e);
}
}
}

View File

@@ -0,0 +1,186 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.core.swagger;
import java.io.Console;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.StringWriter;
import java.io.Writer;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import freemarker.template.Configuration;
import freemarker.template.Template;
import freemarker.template.TemplateException;
import io.swagger.models.Model;
import io.swagger.models.Swagger;
/**
* Handles swagger definitions <code>Entry<String, Model> model : swagger.getDefinitions().entrySet()</code>
*
* @author Paul Brodner
*/
public class SwaggerModel
{
private Swagger swagger;
private Entry<String, Model> model;
private Path modelsPath = Paths.get(Paths.get(".").toAbsolutePath().normalize().toFile().getPath(), "src/main/java/org/alfresco/rest/model");
private List<RestModelProperty> properties = new ArrayList<RestModelProperty>();
private Configuration cfg;
private Configuration getConfig() throws IOException
{
if (cfg == null)
{
cfg = new Configuration(Configuration.VERSION_2_3_23);
cfg.setDirectoryForTemplateLoading(new File("src/main/resources"));
}
return cfg;
}
public SwaggerModel(Entry<String, Model> model, Swagger swagger)
{
this.model = model;
this.swagger = swagger;
if(model.getValue().getProperties()!=null)
{
/*
* compute the properties of this model
*/
for (Entry<String, io.swagger.models.properties.Property> property : model.getValue().getProperties().entrySet())
{
if (property.getKey().equals("entry"))
continue;
properties.add(RestModelProperty.build(property));
}
}
}
/**
* @return boolean value if file is already generated in TAS, under 'models' package
*/
public boolean exist()
{
return getPath().exists();
}
/**
* @return the location of the model in TAS
*/
public File getPath()
{
return Paths.get(modelsPath.toFile().getPath(), getNameInTAS() + ".java").toFile();
}
/**
* @return original model name as defined in Swagger YAML
*/
public String getName()
{
return model.getKey();
}
/**
* @return the name as it will be used in TAS
*/
public String getNameInTAS()
{
return String.format("Rest%sModel", getName());
}
public List<RestModelProperty> getProperties()
{
return properties;
}
public void setProperties(List<RestModelProperty> properties)
{
this.properties = properties;
}
public void generate() throws IOException, TemplateException
{
Template template = getConfig().getTemplate("rest-model.ftl");
// here we will store all data passed to template
Map<String, Object> data = new HashMap<String, Object>();
data.put("date", new SimpleDateFormat("yyyy-MM-dd HH:mm").format(new Date()));
data.put("author", System.getProperty("user.name"));
data.put("yamlTitle", swagger.getInfo().getTitle());
data.put("yamlBasePath", swagger.getBasePath());
data.put("name", getNameInTAS());
if (!getProperties().isEmpty())
data.put("properties", getProperties());
Writer append = new StringWriter();
template.process(data, append);
append.close();
System.out.println("----- " + getPath().getName() + " -----\n");
System.out.println(Generator.line);
System.out.println(append.toString());
System.out.printf("\nGenerating Model: %-10s to ->'%-60s'", getName(), getPath());
if (exist())
{
Console c = System.console();
if (c != null)
{
System.out.printf("There is already one model created locally: \n%s\nDo you want to override it ?(ENTER=yes, any other key=no):", getPath());
if (c.readLine().length() == 0)
{
writeContent(append.toString());
}
}
}
else
{
writeContent(append.toString());
}
}
private void writeContent(String content) throws IOException
{
FileWriter fw = new FileWriter(getPath());
fw.write(content);
fw.close();
}
}

View File

@@ -0,0 +1,219 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.core.swagger;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.Charset;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Map;
import java.util.Map.Entry;
import org.alfresco.utility.exception.TestConfigurationException;
import org.apache.commons.io.FilenameUtils;
import io.swagger.models.HttpMethod;
import io.swagger.models.Operation;
import io.swagger.models.Swagger;
/**
* Handles all
* <code>Entry<String, io.swagger.models.Path> path : swagger.getPaths().entrySet()</code>
*
* @author Paul Brodner
*/
public class SwaggerPaths
{
private Swagger swagger;
private BufferedWriter fileWithMissingRequests;
private BufferedWriter fileWithImplementedRequests;
private String swaggerFilePath;
private int implementedRequestCount = 0;
private int missingRequestCount = 0;
public SwaggerPaths(Swagger swagger, String swaggerFilePath)
{
this.swagger = swagger;
this.swaggerFilePath = swaggerFilePath;
}
/**
* Compare requests that exist in swagger yaml file vs request implemented in your code
* any findings are saved to a missing-request txt file.
*
* @throws TestConfigurationException
*/
public void computeCoverage()
{
try
{
System.out.println("Start computing the coverage of TAS vs Swagger file. Stand by...");
File missingReq = new File(String.format("missing-requests-%s.txt", FilenameUtils.getBaseName(swaggerFilePath)));
missingReq.delete();
fileWithMissingRequests = new BufferedWriter(new FileWriter(missingReq));
fileWithMissingRequests.write(String.format("BasePath: {%s}", swagger.getBasePath()));
fileWithMissingRequests.newLine();
fileWithMissingRequests.write("These requests generated should be analyzed and modified according to your needs.");
fileWithMissingRequests.newLine();
fileWithMissingRequests.write("PLEASE UPDATE your 'RestReturnedModel' name with the appropiate returned model by your request.");
fileWithMissingRequests.newLine();
fileWithMissingRequests.newLine();
File implReq = new File(String.format("implemented-requests-%s.txt", FilenameUtils.getBaseName(swaggerFilePath)));
implReq.delete();
fileWithImplementedRequests = new BufferedWriter(new FileWriter(implReq));
for (Entry<String, io.swagger.models.Path> path : swagger.getPaths().entrySet())
{
for (Map.Entry<HttpMethod, Operation> operation : path.getValue().getOperationMap().entrySet())
{
searchPattern(path.getKey(), operation);
}
}
System.out.println(toString());
fileWithImplementedRequests.close();
fileWithMissingRequests.close();
if (missingRequestCount > 0)
{
System.out.println("[ERROR] PLEASE ANALYSE THE GENERATED <missing-requests> file(s), it seems some request were NOT implemented!");
}
else
missingReq.delete();
System.out.println("ALSO ANALYZE <implemented-requests.txt> for current implementation, take a look at duplicated requests if any!");
}
catch (IOException e)
{
throw new RuntimeException("Exception while trying to create coverage report.", e);
}
}
/**
* Use RegExp to check for requests in code, line by line: no further algorithm performance analysis required at this time
*
* @param httpMethod
* @param pathUrl
* @param methodName
*/
private void searchPattern(String pathUrl, Entry<HttpMethod, Operation> operation)
{
String originalPathUrl = pathUrl;
String httpMethod = operation.getKey().name();
/* update path url, removing first "/" as implemented in TAS requests. */
if (pathUrl.startsWith("/"))
pathUrl = pathUrl.substring(1, pathUrl.length());
if (pathUrl.contains("{"))
pathUrl = pathUrl.replace("{", "\\{");
/*
* if in code we have something like: <code> "(HttpMethod.GET, "process-definitions?{parameters}" </code>
* our regular expression will search for text insider the 'HttpMethod.GET' concatenated with found 'pathUrl" until the optional double brackets
* RegExp: .*HttpMethod.%s.*\\\"%s\\\"?.*
* Result: .*HttpMethod.GET."process-definition".* - if this line is found we have a match
*/
String patternRegEx = String.format(".*HttpMethod.%s.*\\\"%s\\\"?.*", httpMethod, pathUrl);
// all request are saved under this directory, but limited to the rest/request folder
File project = Paths.get(".").toAbsolutePath().normalize().toFile();
Path requestsPath = Paths.get(project.getPath(), "src/main/java/org/alfresco/rest/requests");
BufferedReader br;
try (DirectoryStream<Path> directoryStream = Files.newDirectoryStream(requestsPath))
{
boolean found = false;
for (Path path : directoryStream)
{
if (Files.isRegularFile(path) && Files.isReadable(path))
{
String line;
InputStream fis = new FileInputStream(path.toFile());
InputStreamReader isr = new InputStreamReader(fis, Charset.forName("UTF-8"));
br = new BufferedReader(isr);
while ((line = br.readLine()) != null)
{
if (line.matches(patternRegEx))
{
// log("OK - Pattern %-60s found in: {%s} file." , originalPathUrl, path.getFileName());
fileWithImplementedRequests.write(String.format("%-10s %-60s %s", httpMethod, pathUrl, path.getFileName()));
fileWithImplementedRequests.newLine();
fileWithImplementedRequests.flush();
implementedRequestCount += 1;
found = true;
}
}
br.close();
}
}
if (!found)
{
fileWithMissingRequests.write(String.format("%-10s %-60s %s", httpMethod, originalPathUrl, patternRegEx));
fileWithMissingRequests.newLine();
SwaggerRequest swaggerReqModel = new SwaggerRequest(httpMethod, pathUrl, operation.getValue());
fileWithMissingRequests.write(swaggerReqModel.getRequestSample());
fileWithMissingRequests.flush();
missingRequestCount += 1;
}
}
catch (IOException ex)
{
ex.printStackTrace();
}
}
@Override
public String toString()
{
StringBuilder sb = new StringBuilder();
sb.append("|\n").append("|------------------------------------------------------------------------\n").append("COVERAGE: ")
.append(swaggerFilePath).append("\n");
int percentage = (implementedRequestCount * 100) / (implementedRequestCount + missingRequestCount);
sb.append("\t\tImplemented:\t").append(String.valueOf(percentage)).append("% [# ").append(implementedRequestCount).append("]\t Missing: ");
percentage = (missingRequestCount * 100) / (implementedRequestCount + missingRequestCount);
sb.append(String.valueOf(percentage)).append("% [# ").append(missingRequestCount).append("]");
return sb.toString();
}
}

View File

@@ -0,0 +1,92 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.core.swagger;
import java.io.File;
import java.io.IOException;
import java.io.StringWriter;
import java.io.Writer;
import java.util.HashMap;
import java.util.Map;
import freemarker.template.Configuration;
import freemarker.template.Template;
import freemarker.template.TemplateException;
import io.swagger.models.Operation;
public class SwaggerRequest
{
private Configuration cfg;
private Operation swaggerRequest;
private String httpMethod;
private String pathUrl;
private Configuration getConfig()
{
if (cfg == null)
{
cfg = new Configuration(Configuration.VERSION_2_3_23);
try
{
cfg.setDirectoryForTemplateLoading(new File("src/main/resources"));
}
catch (IOException e)
{
throw new IllegalStateException("Exception while configuring Freemarker template directory.", e);
}
}
return cfg;
}
public SwaggerRequest(String httpMethod, String pathUrl, Operation swaggerRequest)
{
this.swaggerRequest = swaggerRequest;
this.httpMethod = httpMethod;
this.pathUrl = pathUrl;
}
public String getRequestSample()
{
try
{
Template template = getConfig().getTemplate("rest-request.ftl");
Map<String, Object> data = new HashMap<String, Object>();
data.put("operationId", swaggerRequest.getOperationId());
data.put("httpMethod", httpMethod);
data.put("pathUrl", pathUrl);
Writer append = new StringWriter();
template.process(data, append);
append.close();
return append.toString();
}
catch (IOException | TemplateException e)
{
throw new IllegalStateException("Exception while loading sample request.", e);
}
}
}

View File

@@ -0,0 +1,104 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.core.swagger;
import org.alfresco.utility.exception.TestConfigurationException;
import io.swagger.models.Swagger;
import io.swagger.parser.SwaggerParser;
/**
* This will handle the Swagger YAML file
* It will contain all the models, request or any other properties needed for out generator
*
* @author Paul Brodner
*/
public class SwaggerYamlParser
{
private Swagger swagger;
private String swaggerFilePath;
public SwaggerYamlParser(String swaggerFilePath) throws TestConfigurationException
{
if (swaggerFilePath == null)
throw new TestConfigurationException("'swaggerFilePath' not defined. Please update your pom.xml file with all '<swagger-file-location.yml>'");
this.swaggerFilePath = swaggerFilePath;
this.swagger = new SwaggerParser().read(this.swaggerFilePath);
}
public void computeCoverage()
{
new SwaggerPaths(swagger, this.swaggerFilePath).computeCoverage();
}
public void generateMissingModules()
{
String modelParamValue = System.getProperty("models");
SwaggerDefinitions swaggerDefinitions = new SwaggerDefinitions(swagger);
System.out.println(Generator.line);
System.out.println("Using SWAGGER FILE: " + this.swaggerFilePath);
System.out.println(Generator.line);
/*
* multiple models, separated by comma: 'mvn exec:java -Dmodels=a,b,d'
*/
if (modelParamValue.contains(","))
{
String[] models = {};
models = modelParamValue.split(",");
for (int i = 0; i < models.length; i++)
{
// generate model
swaggerDefinitions.generateDefinition(models[i]);
}
}
else
{
/*
* if no value is added after models "mvn exec:java -Dmodels"
* then we assume that we want to generate all models
*/
if (modelParamValue.equals("true"))
{
swaggerDefinitions.generateMissingDefinitions();
}
/*
* there is just one model passed as value "mvn exec:java -Dmodels=a"
* so only model "a" is generated locally
*/
else
{
swaggerDefinitions.generateDefinition(modelParamValue);
}
}
}
}

View File

@@ -0,0 +1,36 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.exception;
public class EmptyJsonResponseException extends RuntimeException
{
private static final long serialVersionUID = 1L;
public EmptyJsonResponseException(String message)
{
super(String.format("Empty JSON Response returned. Possible API bug, please investigate this further. Message: %s", message));
}
}

View File

@@ -0,0 +1,38 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.exception;
import java.util.Collection;
public class EmptyRestModelCollectionException extends Exception
{
private static final long serialVersionUID = 1L;
public <E> EmptyRestModelCollectionException(Collection<E> models)
{
super(String.format("Empty Rest Model Collection of type: %s -> %s", models.getClass(), models.toString()));
}
}

View File

@@ -0,0 +1,38 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.exception;
public class JsonToModelConversionException extends RuntimeException
{
private static final long serialVersionUID = 1L;
public <T> JsonToModelConversionException(Class<T> classz, Exception e)
{
super(String.format("Could not parse Json Response to model [%s] error: %s", classz.getName(), e.getMessage()));
}
}

View File

@@ -0,0 +1,36 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
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);
}
}

View File

@@ -0,0 +1,167 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.core.IRestModel;
import org.alfresco.utility.model.TestModel;
public class RestAbstractClassModel extends TestModel implements IRestModel<RestAbstractClassModel>
{
@JsonProperty(value = "entry")
RestAbstractClassModel model;
@Override
public RestAbstractClassModel onModel()
{
return model;
}
public String id;
public String title;
public String description;
public String parentId;
public Boolean isContainer = null;
public Boolean isArchive = null;
public Boolean includedInSupertypeQuery = null;
public List<String> mandatoryAspects = null;
public List<RestClassAssociationModel> associations = null;
public List <RestPropertyDefinitionModel> properties = null;
@JsonProperty(value = "model")
public RestClassModel modelInfo;
public String getId()
{
return id;
}
public void setId(String id)
{
this.id = id;
}
public String getTitle()
{
return title;
}
public void setTitle(String title)
{
this.title = title;
}
public String getDescription() {
return description;
}
public void setDescription(String description)
{
this.description = description;
}
public String getParentId()
{
return parentId;
}
public void setParentId(String parentId)
{
this.parentId = parentId;
}
public Boolean getContainer()
{
return isContainer;
}
public void setContainer(Boolean container)
{
isContainer = container;
}
public Boolean getArchive()
{
return isArchive;
}
public void setArchive(Boolean archive)
{
isArchive = archive;
}
public Boolean getIncludedInSupertypeQuery()
{
return includedInSupertypeQuery;
}
public void setIncludedInSupertypeQuery(Boolean includedInSupertypeQuery)
{
this.includedInSupertypeQuery = includedInSupertypeQuery;
}
public List<String> getMandatoryAspects()
{
return mandatoryAspects;
}
public void setMandatoryAspects(List<String> mandatoryAspects)
{
this.mandatoryAspects = mandatoryAspects;
}
public List<RestClassAssociationModel> getAssociations()
{
return associations;
}
public void setAssociations(List<RestClassAssociationModel> associations)
{
this.associations = associations;
}
public List<RestPropertyDefinitionModel> getProperties() {
return properties;
}
public void setProperties(List<RestPropertyDefinitionModel> properties)
{
this.properties = properties;
}
public RestClassModel getModelInfo()
{
return modelInfo;
}
public void setModelInfo(RestClassModel modelInfo)
{
this.modelInfo = modelInfo;
}
}

View File

@@ -0,0 +1,102 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import java.io.Serializable;
import java.util.Map;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.core.IRestModel;
import org.alfresco.utility.model.TestModel;
/**
* Generated by 'Kristian.Dimitrov@hyland.com' on '2022-07-14 13:22' from 'Alfresco Content Services REST API' swagger file
* Generated from 'Alfresco Content Services REST API' swagger file
* Base Path {@linkplain /alfresco/api/-default-/public/alfresco/versions/1}
*/
public class RestActionBodyExecTemplateModel extends TestModel implements IRestModel<RestActionBodyExecTemplateModel>
{
@JsonProperty(value = "entry")
RestActionBodyExecTemplateModel model;
@Override
public RestActionBodyExecTemplateModel onModel()
{
return model;
}
@JsonProperty(required = true)
private String actionDefinitionId;
private Map<String, Serializable> params;
public String getActionDefinitionId()
{
return this.actionDefinitionId;
}
public void setActionDefinitionId(String actionDefinitionId)
{
this.actionDefinitionId = actionDefinitionId;
}
public Map<String, Serializable> getParams()
{
return this.params;
}
public void setParams(Map<String, Serializable> params)
{
this.params = params;
}
@Override
public String toString()
{
return "RestActionBodyExecTemplateModel{" + "actionDefinitionId='" + actionDefinitionId + '\'' + ", params=" + params + '}';
}
@Override
public boolean equals(Object o)
{
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
RestActionBodyExecTemplateModel that = (RestActionBodyExecTemplateModel) o;
return Objects.equals(actionDefinitionId, that.actionDefinitionId) && Objects.equals(params, that.params);
}
@Override
public int hashCode()
{
return Objects.hash(actionDefinitionId, params);
}
}

View File

@@ -0,0 +1,100 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import java.util.List;
import java.util.Objects;
import org.alfresco.rest.core.IRestModel;
import org.alfresco.utility.model.TestModel;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Generated by 'mpichura' on '2022-10-05 09:58' from 'Alfresco Content Services REST API' swagger file
* Generated from 'Alfresco Content Services REST API' swagger file
* Base Path {@linkplain /alfresco/api/-default-/public/alfresco/versions/1}
*/
public class RestActionConstraintDataModel extends TestModel implements IRestModel<RestActionConstraintDataModel>
{
@JsonProperty(value = "entry")
RestActionConstraintDataModel model;
@Override
public RestActionConstraintDataModel onModel()
{
return model;
}
/**
Constraint value (this can also be a node id)
*/
@JsonProperty(required = true)
private String value;
/**
Constraint display label
*/
private String label;
public String getValue()
{
return this.value;
}
public void setValue(String value)
{
this.value = value;
}
public String getLabel()
{
return this.label;
}
public void setLabel(String label)
{
this.label = label;
}
@Override
public boolean equals(Object o)
{
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
RestActionConstraintDataModel that = (RestActionConstraintDataModel) o;
return value.equals(that.value) && Objects.equals(label, that.label);
}
@Override
public int hashCode()
{
return Objects.hash(value, label);
}
}

View File

@@ -0,0 +1,136 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import java.util.List;
import java.util.Objects;
import org.alfresco.rest.core.IRestModel;
import org.alfresco.utility.model.TestModel;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Generated by 'mpichura' on '2022-10-05 09:58' from 'Alfresco Content Services REST API' swagger file
* Generated from 'Alfresco Content Services REST API' swagger file
* Base Path {@linkplain /alfresco/api/-default-/public/alfresco/versions/1}
*/
public class RestActionConstraintModel extends TestModel implements IRestModel<RestActionConstraintModel>
{
@JsonProperty(value = "entry")
RestActionConstraintModel model;
@Override
public RestActionConstraintModel onModel()
{
return model;
}
/**
Name of the constraint.
*/
private String constraintName;
/**
A list of constraint possbile values along with additional data (label, isNode flag).
Sample object could be:
```JSON
"constraintValues": [
{
"value": "EQUALS",
"label": "Equals"
},
{
"value": "CONTAINS",
"label": "Contains"
},
{
"value": "BEGINS",
"label": "Begins With"
},
{
"value": "ENDS",
"label": "Ends With"
},
{
"value": "GREATER_THAN",
"label": "Greater Than"
},
{
"value": "GREATER_THAN_EQUAL",
"label": "Greater Than Or Equal To"
},
{
"value": "LESS_THAN",
"label": "Less Than"
},
{
"value": "LESS_THAN_EQUAL",
"label": "Less Than Or Equal To"
}
]
*/
private List<RestActionConstraintDataModel> constraintValues;
public String getConstraintName()
{
return this.constraintName;
}
public void setConstraintName(String constraintName)
{
this.constraintName = constraintName;
}
public List<RestActionConstraintDataModel> getConstraintValues()
{
return this.constraintValues;
}
public void setConstraintValues(List<RestActionConstraintDataModel> constraintValues)
{
this.constraintValues = constraintValues;
}
@Override
public boolean equals(Object o)
{
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
RestActionConstraintModel that = (RestActionConstraintModel) o;
return constraintName.equals(that.constraintName) && Objects.equals(constraintValues, that.constraintValues);
}
@Override
public int hashCode()
{
return Objects.hash(constraintName, constraintValues);
}
}

View File

@@ -0,0 +1,135 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.core.IRestModel;
import org.alfresco.utility.model.TestModel;
public class RestActionDefinitionModel extends TestModel implements IRestModel<RestActionDefinitionModel>
{
@JsonProperty(value = "entry")
RestActionDefinitionModel actionDefinitionModel;
private String id;
private String name;
private String title;
private String description;
private List<String> applicableTypes;
private boolean adhocPropertiesAllowed;
private boolean trackStatus;
private List<RestParameterDefinitionModel> parameterDefinitions;
public String getId()
{
return id;
}
public void setId(String id)
{
this.id = id;
}
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
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<String> getApplicableTypes()
{
return applicableTypes;
}
public void setApplicableTypes(List<String> applicableTypes)
{
this.applicableTypes = applicableTypes;
}
public boolean isAdhocPropertiesAllowed()
{
return adhocPropertiesAllowed;
}
public void setAdhocPropertiesAllowed(boolean adhocPropertiesAllowed)
{
this.adhocPropertiesAllowed = adhocPropertiesAllowed;
}
public boolean isTrackStatus()
{
return trackStatus;
}
public void setTrackStatus(boolean trackStatus)
{
this.trackStatus = trackStatus;
}
public List<RestParameterDefinitionModel> getParameterDefinitions()
{
return parameterDefinitions;
}
public void setParameterDefinitions(List<RestParameterDefinitionModel> parameterDefinitions)
{
this.parameterDefinitions = parameterDefinitions;
}
@Override
public RestActionDefinitionModel onModel()
{
return actionDefinitionModel;
}
}

View File

@@ -0,0 +1,33 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import org.alfresco.rest.core.RestModels;
public class RestActionDefinitionModelsCollection extends RestModels<RestActionDefinitionModel, RestActionDefinitionModelsCollection>
{
}

View File

@@ -0,0 +1,161 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.core.IRestModel;
import org.alfresco.utility.model.TestModel;
/**
*
* @author Cristina Axinte
*
* Handles single Activity JSON responses
* Example:
{
"postedAt": "2016-09-30T12:31:54.088+0000",
"feedPersonId": "user-vtcaquckbq",
"postPersonId": "user-vtcaquckbq",
"siteId": "site-mNygPRuKka",
"activitySummary": {
"firstName": "User-vtCaqUCKBq FirstName",
"lastName": "LN-User-vtCaqUCKBq",
"memberFirstName": "User-vtCaqUCKBq FirstName",
"role": "SiteManager",
"memberLastName": "LN-User-vtCaqUCKBq",
"title": "User-vtCaqUCKBq FirstName LN-User-vtCaqUCKBq (User-vtCaqUCKBq)",
"memberPersonId": "User-vtCaqUCKBq"
},
"id": 14689,
"activityType": "org.alfresco.site.user-joined"
}
*
*/
public class RestActivityModel extends TestModel implements IRestModel<RestActivityModel>
{
@JsonProperty(value = "entry")
RestActivityModel activityModel;
@Override
public RestActivityModel onModel()
{
return activityModel;
}
@JsonProperty(required = true)
String id;
/**
* The id of the person who performed the activity
*/
@JsonProperty(required = true)
String postPersonId;
String siteId;
String postedAt;
/**
* The feed on which this activity was posted
*/
@JsonProperty(required = true)
String feedPersonId;
RestActivitySummaryModel activitySummary;
@JsonProperty(required = true)
String activityType;
public String getActivityType()
{
return activityType;
}
public void setActivityType(String activityType)
{
this.activityType = activityType;
}
public String getId()
{
return id;
}
public void setId(String id)
{
this.id = id;
}
public String getPostPersonId()
{
return postPersonId;
}
public void setPostPersonId(String postPersonId)
{
this.postPersonId = postPersonId;
}
public String getSiteId()
{
return siteId;
}
public void setSiteID(String siteId)
{
this.siteId = siteId;
}
public String getPostedAt()
{
return postedAt;
}
public void setPostedAt(String postedAt)
{
this.postedAt = postedAt;
}
public String getFeedPersonId()
{
return feedPersonId;
}
public void setFeedPersonId(String feedPersonId)
{
this.feedPersonId = feedPersonId;
}
public RestActivitySummaryModel getActivitySummary()
{
return activitySummary;
}
public void setActivitySummary(RestActivitySummaryModel activitySummary)
{
this.activitySummary = activitySummary;
}
}

View File

@@ -0,0 +1,69 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import org.alfresco.rest.core.RestModels;
/**
*
* @author Cristina Axinte
*
* /**
* Handle collection of <RestActivityModel>
* Example:
{
"list": {
"pagination": {
"count": 3,
"hasMoreItems": false,
"skipCount": 0,
"maxItems": 100
},
"entries": [
{
"entry": {
"postedAt": "2016-09-30T12:31:55.923+0000",
"feedPersonId": "user-vtcaquckbq",
"postPersonId": "user-vtcaquckbq",
"siteId": "site-mNygPRuKka",
"activitySummary": {
"firstName": "User-vtCaqUCKBq FirstName",
"lastName": "LN-User-vtCaqUCKBq",
"parentObjectId": "e982c6b7-e16e-4a25-ae77-5ed96614e871",
"title": "file-bWbaaGycDm.txt",
"objectId": "3a647ca9-cef9-45d0-ae4a-49cffa131154"
},
"id": 14692,
"activityType": "org.alfresco.documentlibrary.file-added"
}
}
]
}
}
*
*/
public class RestActivityModelsCollection extends RestModels<RestActivityModel, RestActivityModelsCollection>
{
}

View File

@@ -0,0 +1,144 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.core.IRestModel;
import org.alfresco.utility.constants.UserRole;
import org.alfresco.utility.model.TestModel;
/**
*
* "activitySummary": {
"firstName": "string",
"lastName": "string",
"parentObjectId": "string",
"title": "string",
"objectId": "string"
}
*
* @author Cristina Axinte
*
*/
public class RestActivitySummaryModel extends TestModel implements IRestModel<RestActivitySummaryModel>
{
@JsonProperty(value = "entry")
RestActivitySummaryModel activitySummaryModel;
@Override
public RestActivitySummaryModel onModel()
{
return activitySummaryModel;
}
String firstName;
String lastName;
String parentObjectId;
String title;
String objectId;
String memberFirstName;
UserRole role;
String memberLastName;
String memberPersonId;
public String getMemberFirstName()
{
return memberFirstName;
}
public void setMemberFirstName(String memberFirstName)
{
this.memberFirstName = memberFirstName;
}
public UserRole getRole()
{
return role;
}
public void setRole(UserRole role)
{
this.role = role;
}
public String getMemberLastName()
{
return memberLastName;
}
public void setMemberLastName(String memberLastName)
{
this.memberLastName = memberLastName;
}
public String getMemberPersonId()
{
return memberPersonId;
}
public void setMemberPersonId(String memberPersonId)
{
this.memberPersonId = memberPersonId;
}
public String getFirstName()
{
return firstName;
}
public void setFirstName(String firstName)
{
this.firstName = firstName;
}
public String getLastName()
{
return lastName;
}
public void setLastName(String lastName)
{
this.lastName = lastName;
}
public String getParentObjectId()
{
return parentObjectId;
}
public void setParentObjectId(String parentObjectId)
{
this.parentObjectId = parentObjectId;
}
public String getTitle()
{
return title;
}
public void setTitle(String title)
{
this.title = title;
}
public String getObjectId()
{
return objectId;
}
public void setObjectId(String objectId)
{
this.objectId = objectId;
}
}

View File

@@ -0,0 +1,67 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.core.IRestModel;
import org.alfresco.utility.model.TestModel;
public class RestAggregateModel extends TestModel implements IRestModel<RestAggregateModel>
{
@JsonProperty(value = "aggregate")
RestAggregateModel model;
@JsonProperty(required = true)
private int numberOfRatings;
private String average;
@Override
public RestAggregateModel onModel()
{
return model;
}
public int getNumberOfRatings()
{
return numberOfRatings;
}
public void setNumberOfRatings(int numberOfRatings)
{
this.numberOfRatings = numberOfRatings;
}
public String getAverage()
{
return average;
}
public void setAverage(String average)
{
this.average = average;
}
}

View File

@@ -0,0 +1,72 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
/*
* Copyright 2021 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 com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.core.IRestModel;
import org.alfresco.utility.model.TestModel;
/**
* Generated by 'dedwards' on '2021-12-16 08:32' from 'Alfresco Content Services REST API' swagger file
* Generated from 'Alfresco Content Services REST API' swagger file
* Base Path {@linkplain /alfresco/api/-default-/public/alfresco/versions/1}
*/
public class RestArchiveContentRequestModel extends TestModel implements IRestModel<RestArchiveContentRequestModel>
{
@JsonProperty(value = "entry")
RestArchiveContentRequestModel model;
@Override
public RestArchiveContentRequestModel onModel()
{
return model;
}
/**
A map (String-String) of archive request properties for given content.
*/
private Object archiveProperties;
public Object getArchiveProperties()
{
return this.archiveProperties;
}
public void setArchiveProperties(Object archiveProperties)
{
this.archiveProperties = archiveProperties;
}
}

View File

@@ -0,0 +1,30 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
public class RestAspectModel extends RestAbstractClassModel
{
}

View File

@@ -0,0 +1,32 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import org.alfresco.rest.core.RestModels;
public class RestAspectsCollection extends RestModels<RestAspectModel, RestAspectsCollection>
{
}

View File

@@ -0,0 +1,86 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.core.IRestModel;
import org.alfresco.utility.model.TestModel;
/**
* Generated by 'aepure' on '2017-06-29 15:31' from 'Alfresco Content Services REST API' swagger file
* Generated from 'Alfresco Content Services REST API' swagger file
* Base Path {@linkplain /alfresco/api/-default-/public/alfresco/versions/1}
*/
public class RestAuditAppModel extends TestModel implements IRestModel<RestAuditAppModel>
{
@JsonProperty(value = "entry")
RestAuditAppModel model;
@Override
public RestAuditAppModel onModel()
{
return model;
}
@JsonProperty(required = true)
private String id;
private String name;
private boolean isEnabled;
public String getId()
{
return this.id;
}
public void setId(String id)
{
this.id = id;
}
public String getName()
{
return this.name;
}
public void setName(String name)
{
this.name = name;
}
public boolean getIsEnabled()
{
return this.isEnabled;
}
public void setIsEnabled(boolean isEnabled)
{
this.isEnabled = isEnabled;
}
}

View File

@@ -0,0 +1,33 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import org.alfresco.rest.core.RestModels;
public class RestAuditAppModelsCollection extends RestModels<RestAuditAppModel, RestAuditAppModelsCollection>
{
}

View File

@@ -0,0 +1,106 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.core.IRestModel;
import org.alfresco.utility.model.TestModel;
public class RestAuditEntryModel extends TestModel implements IRestModel<RestAuditEntryModel>
{
@JsonProperty(value = "entry")
RestAuditEntryModel model;
@Override
public RestAuditEntryModel onModel()
{
return model;
}
@JsonProperty(required = true)
private String id;
private String auditApplicationId ;
private String createdAt;
@JsonProperty("createdByUser")
private RestByUserModel createdByUser;
@JsonProperty("values")
Map<String, Object> values;
public Map<String, Object> getValues()
{
return values;
}
public void setValues(Map<String, Object> values)
{
this.values = values;
}
public String getId()
{
return this.id;
}
public void setId(String id)
{
this.id = id;
}
public String getAuditApplicationId()
{
return this.auditApplicationId;
}
public void setAuditApplicationId(String auditApplicationId)
{
this.auditApplicationId = auditApplicationId;
}
public RestByUserModel getCreatedByUser()
{
return this.createdByUser;
}
public void setCreatedByUser(RestByUserModel createdByUser)
{
this.createdByUser = createdByUser;
}
public String getCreatedAt()
{
return this.createdAt;
}
public void setCreatedAt(String createdAt)
{
this.createdAt = createdAt;
}
}

View File

@@ -0,0 +1,33 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import org.alfresco.rest.core.RestModels;
public class RestAuditEntryModelsCollection extends RestModels<RestAuditEntryModel, RestAuditEntryModelsCollection>
{
}

View File

@@ -0,0 +1,52 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import org.alfresco.utility.model.TestModel;
public class RestAuditValuesModel extends TestModel
{
public String getDisplayName()
{
return displayName;
}
public void setDisplayName(String displayName)
{
this.displayName = displayName;
}
public String getId()
{
return id;
}
public void setId(String id)
{
this.id = id;
}
private String displayName;
private String id;
}

View File

@@ -0,0 +1,57 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import org.alfresco.utility.model.TestModel;
/**
* Created by Claudia Agache on 11/11/2016.
*/
public class RestByUserModel extends TestModel
{
private String displayName;
private String id;
public String getDisplayName()
{
return displayName;
}
public void setDisplayName(String displayName)
{
this.displayName = displayName;
}
public String getId()
{
return id;
}
public void setId(String id)
{
this.id = id;
}
}

View File

@@ -0,0 +1,71 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.core.IRestModel;
import org.alfresco.utility.model.TestModel;
public class RestCandidateModel extends TestModel implements IRestModel<RestCandidateModel>
{
@JsonProperty(value = "entry")
RestCandidateModel model;
public enum CandidateType
{
USER, GROUP
}
private String candidateType;
private String candidateId;
@Override
public RestCandidateModel onModel()
{
return model;
}
public String getCandidateType()
{
return candidateType;
}
public void setCandidateType(String candidateType)
{
this.candidateType = candidateType;
}
public String getCandidateId()
{
return candidateId;
}
public void setCandidateId(String candidateId)
{
this.candidateId = candidateId;
}
}

View File

@@ -0,0 +1,33 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import org.alfresco.rest.core.RestModels;
public class RestCandidateModelsCollection extends RestModels<RestCandidateModel, RestCandidateModelsCollection>
{
}

View File

@@ -0,0 +1,87 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import org.alfresco.utility.model.TestModel;
public class RestClassAssociationDefinitionModel extends TestModel
{
public String role = null;
public String cls = null;
public Boolean isMany = null;
public Boolean isMandatory = null;
public Boolean isMandatoryEnforced = null;
public String getRole()
{
return role;
}
public void setRole(String role)
{
this.role = role;
}
public String getCls()
{
return cls;
}
public void setCls(String cls)
{
this.cls = cls;
}
public Boolean getMany()
{
return isMany;
}
public void setMany(Boolean many)
{
isMany = many;
}
public Boolean getMandatory()
{
return isMandatory;
}
public void setMandatory(Boolean mandatory)
{
isMandatory = mandatory;
}
public Boolean getMandatoryEnforced()
{
return isMandatoryEnforced;
}
public void setMandatoryEnforced(Boolean mandatoryEnforced)
{
isMandatoryEnforced = mandatoryEnforced;
}
}

View File

@@ -0,0 +1,111 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import org.alfresco.utility.model.TestModel;
public class RestClassAssociationModel extends TestModel
{
public String id;
public String title;
public String description;
public Boolean isChild;
public Boolean isProtected;
public RestClassAssociationDefinitionModel source = null;
public RestClassAssociationDefinitionModel target = null;
public String getId()
{
return id;
}
public void setId(String id)
{
this.id = id;
}
public String getTitle()
{
return title;
}
public void setTitle(String title)
{
this.title = title;
}
public String getDescription()
{
return description;
}
public void setDescription(String description)
{
this.description = description;
}
public Boolean getChild()
{
return isChild;
}
public void setIsChild(Boolean isChild)
{
this.isChild = isChild;
}
public Boolean getIsProtected()
{
return isProtected;
}
public void setIsProtected(Boolean isProtected)
{
this.isProtected = isProtected;
}
public RestClassAssociationDefinitionModel getSource()
{
return source;
}
public void setSource(RestClassAssociationDefinitionModel source)
{
this.source = source;
}
public RestClassAssociationDefinitionModel getTarget()
{
return target;
}
public void setTarget(RestClassAssociationDefinitionModel target)
{
this.target = target;
}
}

View File

@@ -0,0 +1,87 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import org.alfresco.utility.model.TestModel;
public class RestClassModel extends TestModel
{
public String id;
public String author;
public String description;
public String namespaceUri;
public String namespacePrefix;
public String getId()
{
return id;
}
public void setId(String id)
{
this.id = id;
}
public String getAuthor()
{
return author;
}
public void setAuthor(String author)
{
this.author = author;
}
public String getDescription()
{
return description;
}
public void setDescription(String description)
{
this.description = description;
}
public String getNamespaceUri()
{
return namespaceUri;
}
public void setNamespaceUri(String namespaceUri)
{
this.namespaceUri = namespaceUri;
}
public String getNamespacePrefix()
{
return namespacePrefix;
}
public void setNamespacePrefix(String namespacePrefix)
{
this.namespacePrefix = namespacePrefix;
}
}

View File

@@ -0,0 +1,143 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.core.IRestModel;
import org.alfresco.utility.model.TestModel;
public class RestCommentModel extends TestModel implements IRestModel<RestCommentModel>
{
@JsonProperty(value = "entry")
RestCommentModel model;
@Override
public RestCommentModel onModel()
{
return model;
}
private String createdAt;
private RestPersonModel createdBy;
private String edited;
private String modifiedAt;
private boolean canEdit;
private RestPersonModel modifiedBy;
private boolean canDelete;
private String id;
private String content;
public String getCreatedAt()
{
return createdAt;
}
public void setCreatedAt(String createdAt)
{
this.createdAt = createdAt;
}
public String getEdited()
{
return edited;
}
public void setEdited(String edited)
{
this.edited = edited;
}
public String getContent()
{
return content;
}
public void setContent(String content)
{
this.content = content;
}
public RestPersonModel getCreatedBy()
{
return createdBy;
}
public void RestPersonModel(RestPersonModel createdBy)
{
this.createdBy = createdBy;
}
public String getModifiedAt()
{
return modifiedAt;
}
public void setModifiedAt(String modifiedAt)
{
this.modifiedAt = modifiedAt;
}
public boolean isCanEdit()
{
return canEdit;
}
public void setCanEdit(boolean canEdit)
{
this.canEdit = canEdit;
}
public RestPersonModel getModifiedBy()
{
return modifiedBy;
}
public void setModifiedBy(RestPersonModel modifiedBy)
{
this.modifiedBy = modifiedBy;
}
public boolean isCanDelete()
{
return canDelete;
}
public void setCanDelete(boolean canDelete)
{
this.canDelete = canDelete;
}
public String getId()
{
return id;
}
public void setId(String id)
{
this.id = id;
}
}

View File

@@ -0,0 +1,32 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import org.alfresco.rest.core.RestModels;
public class RestCommentModelsCollection extends RestModels<RestCommentModel, RestCommentModelsCollection>
{
}

View File

@@ -0,0 +1,143 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.core.IRestModel;
import org.alfresco.utility.model.TestModel;
/**
"company": {
"organization": "myCompany",
"address1": "Iasi",
"address2": "City",
"address3": "trei",
"postcode": "1234556",
"telephone": "564510213453",
"fax": "541",
"email": "qLZ41D2QnXQcqySNK09J@yahoo.com"
}
*/
public class RestCompanyModel extends TestModel implements IRestModel<RestCompanyModel>
{
@JsonProperty (value = "entry")
RestCompanyModel model;
private String organization;
private String address1;
private String address2;
private String address3;
private String postcode;
private String telephone;
private String fax;
private String email;
@Override
public RestCompanyModel onModel()
{
return model;
}
public String getOrganization()
{
return organization;
}
public void setOrganization(String organization)
{
this.organization = organization;
}
public String getAddress1()
{
return address1;
}
public void setAddress1(String address1)
{
this.address1 = address1;
}
public String getAddress2()
{
return address2;
}
public void setAddress2(String address2)
{
this.address2 = address2;
}
public String getAddress3()
{
return address3;
}
public void setAddress3(String address3)
{
this.address3 = address3;
}
public String getPostcode()
{
return postcode;
}
public void setPostcode(String postcode)
{
this.postcode = postcode;
}
public String getTelephone()
{
return telephone;
}
public void setTelephone(String telephone)
{
this.telephone = telephone;
}
public String getFax()
{
return fax;
}
public void setFax(String fax)
{
this.fax = fax;
}
public String getEmail()
{
return email;
}
public void setEmail(String email)
{
this.email = email;
}
}

View File

@@ -0,0 +1,138 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import java.util.List;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.core.IRestModel;
import org.alfresco.utility.model.TestModel;
/**
* Generated by 'Kristian.Dimitrov@hyland.com' on '2022-07-13 15:53' from 'Alfresco Content Services REST API' swagger file
* Generated from 'Alfresco Content Services REST API' swagger file
* Base Path {@linkplain /alfresco/api/-default-/public/alfresco/versions/1}
*/
public class RestCompositeConditionDefinitionModel extends TestModel implements IRestModel<RestCompositeConditionDefinitionModel>
{
@JsonProperty(value = "entry")
RestCompositeConditionDefinitionModel model;
@Override
public RestCompositeConditionDefinitionModel onModel()
{
return model;
}
/**
Whether to invert the logic for this condition (if true then "not" is applied to the whole condition)
*/
private boolean inverted;
/**
How to combine the clauses of this condition ("and" or "or")
*/
private String booleanMode;
/**
Nested list of composite clauses in this condition
*/
private List<RestCompositeConditionDefinitionModel> compositeConditions;
/**
Nested list of simple (per field) conditions.
*/
private List<RestSimpleConditionDefinitionModel> simpleConditions;
public boolean getInverted()
{
return this.inverted;
}
public void setInverted(boolean inverted)
{
this.inverted = inverted;
}
public String getBooleanMode()
{
return this.booleanMode;
}
public void setBooleanMode(String booleanMode)
{
this.booleanMode = booleanMode;
}
public List<RestCompositeConditionDefinitionModel> getCompositeConditions()
{
return this.compositeConditions;
}
public void setCompositeConditions(List<RestCompositeConditionDefinitionModel> compositeConditions)
{
this.compositeConditions = compositeConditions;
}
public List<RestSimpleConditionDefinitionModel> getSimpleConditions()
{
return this.simpleConditions;
}
public void setSimpleConditions(List<RestSimpleConditionDefinitionModel> simpleConditions)
{
this.simpleConditions = simpleConditions;
}
@Override
public String toString()
{
return "RestCompositeConditionDefinitionModel{" + "inverted=" + inverted + ", booleanMode='" + booleanMode + '\'' + ", compositeConditions=" + compositeConditions
+ ", simpleConditions=" + simpleConditions + '}';
}
@Override
public boolean equals(Object o)
{
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
RestCompositeConditionDefinitionModel that = (RestCompositeConditionDefinitionModel) o;
return inverted == that.inverted && Objects.equals(booleanMode, that.booleanMode) && Objects.equals(compositeConditions, that.compositeConditions) && Objects.equals(
simpleConditions, that.simpleConditions);
}
@Override
public int hashCode()
{
return Objects.hash(inverted, booleanMode, compositeConditions, simpleConditions);
}
}

View File

@@ -0,0 +1,87 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import java.util.Map;
public class RestConstraintDefinitionModel
{
private String id;
private String type;
private String title;
private String description;
private Map<String, Object> parameters;
public String getId()
{
return id;
}
public void setId(String id)
{
this.id = id;
}
public String getType()
{
return type;
}
public void setType(String type)
{
this.type = type;
}
public String getTitle()
{
return title;
}
public void setTitle(String title)
{
this.title = title;
}
public String getDescription()
{
return description;
}
public void setDescription(String description)
{
this.description = description;
}
public Map<String, Object> getParameters()
{
return parameters;
}
public void setParameters(Map<String, Object> parameters)
{
this.parameters = parameters;
}
}

View File

@@ -0,0 +1,92 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import org.alfresco.utility.model.TestModel;
import java.util.Set;
/**
* Created by Claudia Agache on 11/11/2016.
*/
public class RestContentModel extends TestModel
{
private int sizeInBytes;
private String mimeTypeName;
private String mimeType;
private String encoding;
private Set<String> storageClasses;
public int getSizeInBytes()
{
return sizeInBytes;
}
public void setSizeInBytes(int sizeInBytes)
{
this.sizeInBytes = sizeInBytes;
}
public String getMimeTypeName()
{
return mimeTypeName;
}
public void setMimeTypeName(String mimeTypeName)
{
this.mimeTypeName = mimeTypeName;
}
public String getMimeType()
{
return mimeType;
}
public void setMimeType(String mimeType)
{
this.mimeType = mimeType;
}
public String getEncoding()
{
return encoding;
}
public void setEncoding(String encoding)
{
this.encoding = encoding;
}
public Set<String> getStorageClasses()
{
return storageClasses;
}
public void setStorageClasses(Set<String> storageClasses)
{
this.storageClasses = storageClasses;
}
}

View File

@@ -0,0 +1,91 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
/*
* Copyright 2021 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 java.util.Map;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.core.IRestModel;
import org.alfresco.utility.model.TestModel;
/**
* Generated by 'dedwards' on '2021-12-16 08:32' from 'Alfresco Content Services REST API' swagger file
* Generated from 'Alfresco Content Services REST API' swagger file
* Base Path {@linkplain /alfresco/api/-default-/public/alfresco/versions/1}
*/
public class RestContentStorageInfoModel extends TestModel implements IRestModel<RestContentStorageInfoModel>
{
@JsonProperty(value = "entry")
RestContentStorageInfoModel model;
@Override
public RestContentStorageInfoModel onModel()
{
return model;
}
/**
Content type property identifier (e.g. cm:content). Inside this object only colon (':') delimiter for namespace-prefix will be used.
*/
@JsonProperty(required = true)
private String id;
/**
A map (String-String) of storage properties for given content.
*/
private Map<String, String> storageProperties;
public String getId()
{
return this.id;
}
public void setId(String id)
{
this.id = id;
}
public Map<String, String> getStorageProperties()
{
return this.storageProperties;
}
public void setStorageProperties(Map<String, String> storageProperties)
{
this.storageProperties = storageProperties;
}
}

View File

@@ -0,0 +1,66 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import java.util.ArrayList;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.core.IRestModel;
import org.alfresco.utility.model.CustomAspectModel;
import org.alfresco.utility.model.CustomAspectPropertiesModel;
import org.testng.Assert;
/**
* @author Bogdan Bocancea
*/
public class RestCustomAspectModel extends CustomAspectModel implements IRestModel<RestCustomAspectModel>
{
@JsonProperty(value = "entry")
RestCustomAspectModel model;
@Override
public RestCustomAspectModel onModel()
{
return model;
}
public RestCustomAspectModel assertHasProperties(CustomAspectPropertiesModel... propertiesName)
{
List<String> propertiesModelName = new ArrayList<String>();
List<CustomAspectPropertiesModel> properiesModel = getProperties();
for (CustomAspectPropertiesModel model : properiesModel)
{
propertiesModelName.add(model.getName());
}
for (CustomAspectPropertiesModel property : propertiesName)
{
Assert.assertTrue(propertiesModelName.contains(property.getName()), String.format("Property %s was found.", property.getName()));
}
return this;
}
}

View File

@@ -0,0 +1,46 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.core.IRestModel;
import org.alfresco.utility.model.CustomContentModel;
/**
* @author Bogdan Bocancea
*/
public class RestCustomModel extends CustomContentModel implements IRestModel<RestCustomModel>
{
@JsonProperty(value = "entry")
RestCustomModel model;
@Override
public RestCustomModel onModel()
{
return model;
}
}

View File

@@ -0,0 +1,133 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.core.IRestModel;
import org.alfresco.utility.model.CustomAspectPropertiesModel;
import org.alfresco.utility.model.TestModel;
/**
* @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;
}
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;
}
}

View File

@@ -0,0 +1,110 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.core.IRestModel;
import org.alfresco.utility.model.TestModel;
/**
* Handles single Deployment Entry JSON response
* "entry": {
* "id": "string",
* "name": "string",
* "category": "string",
* "deployedAt": "2016-10-04T13:15:36.222Z"
* }
*
* Created by Claudia Agache on 10/4/2016.
*/
public class RestDeploymentModel extends TestModel implements IRestModel<RestDeploymentModel>
{
@JsonProperty(value = "entry")
RestDeploymentModel model;
@Override
public RestDeploymentModel onModel()
{
return model;
}
public RestDeploymentModel()
{
}
public RestDeploymentModel(String id)
{
setId(id);
}
@JsonProperty(required = true)
private String id;
private String name;
private String category;
private String deployedAt;
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
public String getId()
{
return id;
}
public void setId(String id)
{
this.id = id;
}
public String getCategory()
{
return category;
}
public void setCategory(String category)
{
this.category = category;
}
public String getDeployedAt()
{
return deployedAt;
}
public void setDeployedAt(String deployedAt)
{
this.deployedAt = deployedAt;
}
}

View File

@@ -0,0 +1,71 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import static org.alfresco.utility.report.log.Step.STEP;
import java.util.List;
import org.alfresco.rest.core.RestModels;
/**
* "entries": [
* {
* "entry": {
* "name": "parallel-review-group.bpmn20.xml",
* "id": "17",
* "deployedAt": "2016-03-04T11:28:02.000+0000"
* }
* },
* {
* "entry": {
* "name": "review.bpmn20.xml",
* "id": "5",
* "deployedAt": "2016-03-04T11:28:01.000+0000"
* }
* }
* ]
* Created by Claudia Agache on 10/4/2016.
*/
public class RestDeploymentModelsCollection extends RestModels<RestDeploymentModel, RestDeploymentModelsCollection>
{
public RestDeploymentModel getDeploymentByName(String deploymentName)
{
STEP(String.format("REST API: Get deployment with name '%s'", deploymentName));
List<RestDeploymentModel> deploymentsList = getEntries();
for (RestDeploymentModel deploymentEntry: deploymentsList)
{
if (deploymentEntry.onModel().getName().equals(deploymentName))
{
return deploymentEntry.onModel();
}
}
return null;
}
}

View File

@@ -0,0 +1,56 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.core.IRestModel;
import org.alfresco.utility.model.TestModel;
public class RestDiscoveryModel extends TestModel implements IRestModel<RestDiscoveryModel>
{
@JsonProperty(value = "entry")
RestDiscoveryModel model;
@Override
public RestDiscoveryModel onModel()
{
return model;
}
@JsonProperty(required = true)
private RestRepositoryInfoModel repository;
public RestRepositoryInfoModel getRepository()
{
return repository;
}
public void setRepository(RestRepositoryInfoModel repository)
{
this.repository = repository;
}
}

View File

@@ -0,0 +1,147 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.core.IRestModel;
import org.alfresco.utility.model.TestModel;
/*
* Handles responses for GET /downloads/{downloadId} and POST /downloads rest calls
* E.g
* {
* "entry": {
* "filesAdded": 1,
* "bytesAdded": 4,
* "totalBytes": 4,
* "id": "6ab1357c-bf13-4ecc-9c6e-3af0b6a7bb34",
* "totalFiles": 1,
* "status": "DONE"
* }
* }
*/
public class RestDownloadsModel extends TestModel implements IRestModel<RestDownloadsModel>
{
@JsonProperty(value = "entry")
RestDownloadsModel model;
@Override
public RestDownloadsModel onModel()
{
return model;
}
@JsonProperty(required = true)
private String filesAdded;
@JsonProperty(required = true)
private String bytesAdded;
@JsonProperty(required = true)
private String totalBytes;
@JsonProperty(required = true)
private String id;
@JsonProperty(required = true)
private String totalFiles;
@JsonProperty(required = true)
private String status;
public RestDownloadsModel getModel()
{
return model;
}
public void setModel(RestDownloadsModel model)
{
this.model = model;
}
public String getFilesAdded()
{
return filesAdded;
}
public void setFilesAdded(String filesAdded)
{
this.filesAdded = filesAdded;
}
public String getBytesAdded()
{
return bytesAdded;
}
public void setBytesAdded(String bytesAdded)
{
this.bytesAdded = bytesAdded;
}
public String getTotalBytes()
{
return totalBytes;
}
public void setTotalBytes(String totalBytes)
{
this.totalBytes = totalBytes;
}
public String getId()
{
return id;
}
public void setId(String id)
{
this.id = id;
}
public String getTotalFiles()
{
return totalFiles;
}
public void setTotalFiles(String totalFiles)
{
this.totalFiles = totalFiles;
}
public String getStatus()
{
return status;
}
public void setStatus(String status)
{
this.status = status;
}
}

View File

@@ -0,0 +1,91 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import java.util.List;
import org.alfresco.utility.model.TestModel;
/**
* Created by Meenal Bhave
* "elements": [
* {
* "aspectNames": ["cm:titled", "cm:auditable", "app:uifacets"],
* "id": "7f0c47ae-d334-4b66-a86b-1a60d2518ad1",
* "name": "Folder-oawzdncUXFLgnFe",
* "nodeType": "cm:folder"
* }
* ]
*/
public class RestElementModel extends TestModel
{
private String name;
private String id;
private List<String> aspectNames;
private String nodeType;
public String getId()
{
return id;
}
public void setId(String id)
{
this.id = id;
}
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
public List<String> getAspectNames()
{
return aspectNames;
}
public void setAspectNames(List<String> aspectNames)
{
this.aspectNames = aspectNames;
}
public String getNodeType()
{
return nodeType;
}
public void setNodeType(String nodeType)
{
this.nodeType = nodeType;
}
}

View File

@@ -0,0 +1,110 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import org.alfresco.rest.core.IRestModel;
import org.alfresco.utility.model.TestModel;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Generated by 'saspery' on '2022-09-28 06:54' from 'Alfresco Content Services REST API' swagger file
* Generated from 'Alfresco Content Services REST API' swagger file
* Base Path {@linkplain /alfresco/api}
*/
public class RestEntitlementsInfoModel extends TestModel implements IRestModel<RestEntitlementsInfoModel>
{
@JsonProperty(value = "entry")
RestEntitlementsInfoModel model;
@Override
public RestEntitlementsInfoModel onModel()
{
return model;
}
private int maxUsers;
private int maxDocs;
private boolean isClusterEnabled;
private boolean isCryptodocEnabled;
private boolean isCustomEmbeddedWorkflowEnabled;
public int getMaxUsers()
{
return this.maxUsers;
}
public void setMaxUsers(int maxUsers)
{
this.maxUsers = maxUsers;
}
public int getMaxDocs()
{
return this.maxDocs;
}
public void setMaxDocs(int maxDocs)
{
this.maxDocs = maxDocs;
}
public boolean getIsClusterEnabled()
{
return this.isClusterEnabled;
}
public void setIsClusterEnabled(boolean isClusterEnabled)
{
this.isClusterEnabled = isClusterEnabled;
}
public boolean getIsCryptodocEnabled()
{
return this.isCryptodocEnabled;
}
public void setIsCryptodocEnabled(boolean isCryptodocEnabled)
{
this.isCryptodocEnabled = isCryptodocEnabled;
}
public boolean getIsCustomEmbeddedWorkflowEnabled()
{
return this.isCustomEmbeddedWorkflowEnabled;
}
public void setIsCustomEmbeddedWorkflowEnabled(boolean isCustomEmbeddedWorkflowEnabled)
{
this.isCustomEmbeddedWorkflowEnabled = isCustomEmbeddedWorkflowEnabled;
}
}

View File

@@ -0,0 +1,212 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import org.springframework.http.HttpStatus;
import org.testng.Assert;
public class RestErrorModel
{
private String errorKey = "";
private String logId = "";
private int statusCode = 0;
private String briefSummary = "";
private String stackTrace = "";
private String descriptionURL = "";
public static String PERMISSION_WAS_DENIED = "Permission was denied";
public static String ENTITY_NOT_FOUND = "%s was not found";
public static String ENTITY_WAS_NOT_FOUND = "The entity with id: %s was not found";
public static String RELATIONSHIP_NOT_FOUND = "The relationship resource was not found for the entity with id: %s and a relationship id of %s";
public static String AUTHENTICATION_FAILED = "Authentication failed";
public static String INVALID_ARGUMENT = "An invalid %s was received";
public static String UNABLE_TO_LOCATE = "Unable to locate resource";
public static String NULL_ARGUMENT = "Must provide a non-null %s";
public static String CANNOT_COMMENT = "Cannot comment on this node";
public static String NON_NULL_COMMENT = "Must provide a non-null comment";
public static String INVALID_RATING = "Invalid ratingSchemeId %s";
public static String NO_CONTENT = "Could not read content from HTTP request body: %s";
public static String NULL_LIKE_RATING = "Rating should be non-null and a boolean for 'likes' rating scheme";
public static String NULL_FIVESTAR_RATING = "Rating should be non-null and an integer for 'fiveStar' rating scheme";
public static String CANNOT_RATE = "Cannot rate this node";
public static String CANNOT_TAG = "Cannot tag this node";
public static String NOT_SUFFICIENT_PERMISSIONS = "The current user does not have sufficient permissions to delete membership details of the site %s";
public static String DELETE_EMPTY_ARGUMENT = "DELETE not supported for Actions";
public static String PUT_EMPTY_ARGUMENT = "PUT is executed against the instance URL";
public static String TASK_INVALID_STATE = "The task state property has an invalid value: %s";
public static String INVALID_MAXITEMS = "Invalid paging parameter maxItems:%s";
public static String INVALID_SKIPCOUNT = "Invalid paging parameter skipCount:%s";
public static String INVALID_TAG = "Tag name must not contain %s char sequence";
public static String EMPTY_TAG = "New tag cannot be null";
public static String UNKNOWN_ROLE = "Unknown role '%s'";
public static String ALREADY_Site_MEMBER = "%s is already a member of site %s";
public static String ALREADY_INVITED = "%s is already invited to site %s";
public static String NOT_A_MEMBER = "User is not a member of the site";
public static String ONLY_POSITIVE_VALUES_MAXITEMS = "Only positive values supported for maxItems";
public static String NEGATIVE_VALUES_SKIPCOUNT = "Negative values not supported for skipCount";
public static String PROCESS_ENTITY_NOT_FOUND = "The entity with id: Item %s not found in the process package variable was not found";
public static String MUST_PROVIDE_ROLE = "Must provide a role";
public static String INVALID_ORDERBY = "OrderBy %s is not supported, supported items are [%s]";
public static String ONLY_ONE_ORDERBY = "Only one orderBy parameter is supported";
public static String INVALID_WHERE_QUERY = "An invalid WHERE query was received. %s";
public static String PROCESS_RUNNING_IN_ANOTHER_TENANT = "Process is running in another tenant";
public static String ILLEGAL_SCOPE = "Illegal value for variable scope: '%s'.";
public static String UNSUPPORTED_TYPE = "Unsupported type of variable: '%s'.";
public static String PROPERTY_DOES_NOT_EXIST = "The property selected for update does not exist for this resource: %s";
public static String PROPERTY_IS_NOT_SUPPORTED_EQUALS = "The property '%s' with value '%s' isn't supported for EQUALS comparison";
public static String INVALID_VALUE = "The %s property has an invalid value: %s";
public static String REQUIRED_TO_ADD = "%s is required to add an attached item";
public static String ACCESS_INFORMATION_NOT_ALLOWED = "user is not allowed to access information about process %s";
public static String TASK_ALREADY_COMPLETED = "Task with id: %s cannot be updated, it's completed";
public static String DELEGATED_TASK_CAN_NOT_BE_COMPLETED = "A delegated task cannot be completed, but should be resolved instead.";
public static String UNEXPECTED_TENANT = "Unexpected tenant: %s (contains %s)";
public static String DELETE_LAST_MANAGER = "Can't remove last manager of site %s";
public static String RATING_OUT_OF_BOUNDS = "Rating is out of bounds.";
public static String ACCEPT_ME= "Please accept me";
public static String NO_WORKFLOW_DEFINITION_FOUND = "No workflow definition could be found with key '%s'.";
public static String INVALID_USER_ID = "%s is not a valid person user id";
public static String TASK_ALREADY_CLAIMED = "The task is already claimed by another user.";
public static String INVALID_SELECT = "An invalid SELECT query was received";
public static String DELEGATING_ASSIGNEE_PROVIDED = "When delegating a task, assignee should be selected and provided in the request.";
public static String INVALID_NAMEPACE_PREFIX="Namespace prefix %s is not mapped to a namespace URI";
public static String FOR_INPUT_STRING ="For input string: \"%s\"";
public static String UNRECOGNIZED_FIELD ="Unrecognized field \"%s\"";
public static String LOCAL_NAME_CONSISTANCE = "A QName must consist of a local name";
public static String INVALID_PARAMETER_WHO = "Parameter who should be one of [me, others]";
public static String NOT_FAVOURITE_SITE = "Site %s is not a favourite site";
public static String RESTAPIEXPLORER = "https://api-explorer.alfresco.com";
public static String STACKTRACE = "For security reasons the stack trace is no longer displayed, but the property is kept for previous versions";
public static String RELATIONSHIP_NOT_FOUND_ERRORKEY = "framework.exception.RelationshipNotFound";
public static String ENTITY_NOT_FOUND_ERRORKEY = "framework.exception.EntityNotFound";
public static String PERMISSION_DENIED_ERRORKEY = "framework.exception.PermissionDenied";
public static String API_DEFAULT_ERRORKEY = "framework.exception.ApiDefault";
public static String INVALID_QUERY_ERRORKEY = "framework.exception.InvalidQuery";
public static String INVALID_PROPERTY_ERRORKEY = "framework.exception.InvalidProperty";
public static String NOT_FOUND_ERRORKEY = "framework.exception.NotFound";
public static String VARIABLE_NAME_REQUIRED = "Variable name is required.";
public static String MANDATORY_PARAM = "%s is a mandatory parameter";
public static String MANDATORY_COLLECTION = "%s collection must contain at least one item";
public static String INVALID_SELECT_ERRORKEY = "framework.exception.InvalidSelect";
public static String LOCKED_NODE_OPERATION = "Cannot perform operation since the node (id:%s) is locked.";
public static String LOCKED_NODE_SUMMARY = "The node (id: %s) could not be locked since it is already locked by another user.";
public String getErrorKey()
{
return errorKey;
}
public void setErrorKey(String errorKey)
{
this.errorKey = errorKey;
}
public int getStatusCode()
{
return statusCode;
}
public void setStatusCode(int statusCode)
{
this.statusCode = statusCode;
}
public String getBriefSummary()
{
return briefSummary;
}
public void setBriefSummary(String briefSummary)
{
this.briefSummary = briefSummary;
}
public String getStackTrace()
{
return stackTrace;
}
public void setStackTrace(String stackTrace)
{
this.stackTrace = stackTrace;
}
public String getDescriptionURL()
{
return descriptionURL;
}
public void setDescriptionURL(String descriptionURL)
{
this.descriptionURL = descriptionURL;
}
public String getLogId()
{
return logId;
}
public void setLogId(String logId)
{
this.logId = logId;
}
public RestErrorModel containsSummary(String summary)
{
if (!getBriefSummary().contains(summary))
Assert.fail(String.format("Expected [%s] error to be found in actual briefSummary returned by server: %s", summary, getBriefSummary()));
return this;
}
public RestErrorModel containsErrorKey(String expected)
{
if (!getErrorKey().contains(expected))
Assert.fail(String.format("Expected [%s] error to be found in actual errorKey returned by server: %s", expected, getErrorKey()));
return this;
}
public RestErrorModel statusCodeIs(HttpStatus statusCode)
{
if (getStatusCode() != statusCode.value())
Assert.fail(String.format("Expected [%s] to be found. Actual statusCode returned by server is [%s]", statusCode, getStatusCode()));
return this;
}
public RestErrorModel descriptionURLIs(String expected)
{
if (!getDescriptionURL().equals(expected))
Assert.fail(String.format("Expected [%s] to be found. Actual descriptionURL returned by server is [%s]", expected, getDescriptionURL()));
return this;
}
public RestErrorModel stackTraceIs(String expected)
{
if (!getStackTrace().equals(expected))
Assert.fail(String.format("Expected [%s] to be found. Actual stackTrace returned by server is [%s]", expected, getStackTrace()));
return this;
}
}

View File

@@ -0,0 +1,54 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.core.IRestModel;
import org.alfresco.utility.model.TestModel;
public class RestFavoriteSiteModel extends TestModel implements IRestModel<RestFavoriteSiteModel>
{
@JsonProperty(value = "entry")
RestFavoriteSiteModel model;
@JsonProperty(required = true)
String id;
@Override
public RestFavoriteSiteModel onModel()
{
return model;
}
public String getId()
{
return id;
}
public void setId(String id)
{
this.id = id;
}
}

View File

@@ -0,0 +1,272 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.core.IRestModel;
import org.alfresco.utility.model.TestModel;
/**
* Handles single Folder JSON responses
* Example:
"createdAt": "2016-10-03T09:48:52.385+0000",
"sizeInBytes": 19,
"versionLabel": "1.0",
"createdBy": "admin",
"modifiedAt": "2016-10-03T09:48:52.385+0000",
"name": "file-OUQAyqdsNi.txt",
"guid": "00f6b250-a841-4ff6-b660-5b45cee30497",
"modifiedBy": "admin",
"mimeType": "text/plain",
"id": "00f6b250-a841-4ff6-b660-5b45cee30497"
*/
public class RestFileModel extends TestModel implements IRestModel<RestFileModel>
{
@JsonProperty(value = "entry")
RestFileModel model;
@Override
public RestFileModel onModel()
{
return model;
}
@JsonProperty(required = true)
protected String createdAt;
@JsonProperty(required = true)
protected String sizeInBytes;
@JsonProperty(required = true)
protected String versionLabel;
@JsonProperty(required = true)
protected String createdBy;
@JsonProperty(required = true)
protected String modifiedAt;
@JsonProperty(required = true)
protected String name;
@JsonProperty(required = true)
protected String guid;
@JsonProperty(required = true)
protected String modifiedBy;
@JsonProperty(required = true)
protected String mimeType;
@JsonProperty(required = true)
protected String id;
@JsonProperty(required = false)
RestPathModel path;
private boolean isFile;
private boolean isFolder;
private RestByUserModel createdByUser;
private RestByUserModel modifiedByUser;
private RestContentModel content;
private String parentId;
public RestFileModel()
{
}
public String getCreatedAt()
{
return createdAt;
}
public void setCreatedAt(String createdAt)
{
this.createdAt = createdAt;
}
public String getSizeInBytes()
{
return sizeInBytes;
}
public void setSizeInBytes(String sizeInBytes)
{
this.sizeInBytes = sizeInBytes;
}
public String getVersionLabel()
{
return versionLabel;
}
public void setVersionLabel(String versionLabel)
{
this.versionLabel = versionLabel;
}
public String getCreatedBy()
{
return createdBy;
}
public void setCreatedBy(String createdBy)
{
this.createdBy = createdBy;
}
public String getModifiedBy()
{
return modifiedBy;
}
public void setModifiedBy(String modifiedBy)
{
this.modifiedBy = modifiedBy;
}
public String getModifiedAt()
{
return modifiedAt;
}
public void setModifiedAt(String modifiedAt)
{
this.modifiedAt = modifiedAt;
}
public String getGuid()
{
return guid;
}
public void setGuid(String guid)
{
this.guid = guid;
}
public String getId()
{
return id;
}
public void setId(String id)
{
this.id = id;
}
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
public String getMimeType()
{
return mimeType;
}
public void setMimeType(String mimeType)
{
this.mimeType = mimeType;
}
public boolean getIsFile()
{
return isFile;
}
public void setIsFile(boolean isFile)
{
this.isFile = isFile;
}
public RestByUserModel getCreatedByUser()
{
return createdByUser;
}
public void setCreatedByUser(RestByUserModel createdByUser)
{
this.createdByUser = createdByUser;
}
public RestByUserModel getModifiedByUser()
{
return modifiedByUser;
}
public void setModifiedByUser(RestByUserModel modifiedByUser)
{
this.modifiedByUser = modifiedByUser;
}
public RestContentModel getContent()
{
return content;
}
public void setContent(RestContentModel content)
{
this.content = content;
}
public String getParentId()
{
return parentId;
}
public void setParentId(String parentId)
{
this.parentId = parentId;
}
public boolean getIsFolder()
{
return isFolder;
}
public void setIsFolder(boolean isFolder)
{
this.isFolder = isFolder;
}
public RestPathModel getPath()
{
return path;
}
public void setPath(RestPathModel path)
{
this.path = path;
}
}

View File

@@ -0,0 +1,219 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.core.IRestModel;
import org.alfresco.utility.model.TestModel;
/**
* Handles single Folder JSON responses
* Example:
"createdAt": "2016-10-03T08:15:08.722+0000",
"createdBy": "admin",
"modifiedAt": "2016-10-03T08:15:08.722+0000",
"name": "Folder-EJJXzPAauf",
"guid": "fd84a762-7fea-4ed8-b9cd-7622ab966ac4",
"modifiedBy": "admin",
"id": "fd84a762-7fea-4ed8-b9cd-7622ab966ac4"
*/
public class RestFolderModel extends TestModel implements IRestModel<RestFolderModel>
{
@JsonProperty(value = "entry")
RestFolderModel model;
@Override
public RestFolderModel onModel()
{
return model;
}
@JsonProperty(required = true)
protected String createdAt;
@JsonProperty(required = true)
protected String createdBy;
@JsonProperty(required = true)
protected String modifiedAt;
@JsonProperty(required = true)
protected String name;
@JsonProperty(required = true)
protected String guid;
@JsonProperty(required = true)
protected String modifiedBy;
@JsonProperty(required = true)
protected String id;
@JsonProperty(required = false)
RestPathModel path;
private boolean isFolder;
private boolean isFile;
private RestByUserModel createdByUser;
private RestByUserModel modifiedByUser;
private String parentId;
public RestFolderModel()
{
}
public String getCreatedAt()
{
return createdAt;
}
public void setCreatedAt(String createdAt)
{
this.createdAt = createdAt;
}
public String getCreatedBy()
{
return createdBy;
}
public void setCreatedBy(String createdBy)
{
this.createdBy = createdBy;
}
public String getModifiedBy()
{
return modifiedBy;
}
public void setModifiedBy(String modifiedBy)
{
this.modifiedBy = modifiedBy;
}
public String getModifiedAt()
{
return modifiedAt;
}
public void setModifiedAt(String modifiedAt)
{
this.modifiedAt = modifiedAt;
}
public String getGuid()
{
return guid;
}
public void setGuid(String guid)
{
this.guid = guid;
}
public String getId()
{
return id;
}
public void setId(String id)
{
this.id = id;
}
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
public boolean getIsFolder()
{
return isFolder;
}
public void setIsFolder(boolean isFolder)
{
this.isFolder = isFolder;
}
public boolean getIsFile()
{
return isFile;
}
public void setIsFile(boolean isFile)
{
this.isFile = isFile;
}
public RestByUserModel getCreatedByUser()
{
return createdByUser;
}
public void setCreatedByUser(RestByUserModel createdByUser)
{
this.createdByUser = createdByUser;
}
public RestByUserModel getModifiedByUser()
{
return modifiedByUser;
}
public void setModifiedByUser(RestByUserModel modifiedByUser)
{
this.modifiedByUser = modifiedByUser;
}
public String getParentId()
{
return parentId;
}
public void setParentId(String parentId)
{
this.parentId = parentId;
}
public RestPathModel getPath()
{
return path;
}
public void setPath(RestPathModel path)
{
this.path = path;
}
}

View File

@@ -0,0 +1,135 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.core.IRestModel;
import org.alfresco.utility.model.TestModel;
/**
* Handles single representation of a Start Form Model
* * "entry": {
* "allowedValues": [
* "1",
* "2",
* "3"
* ],
* "qualifiedName": "{http://www.alfresco.org/model/bpm/1.0}workflowPriority",
* "defaultValue": "2",
* "dataType": "d:int",
* "name": "bpm_workflowPriority",
* "title": "Workflow Priority",
* "required": false
* }
* Created by Claudia Agache on 10/18/2016.
*/
public class RestFormModel extends TestModel implements IRestModel<RestFormModel>
{
@JsonProperty(value = "entry") RestFormModel model;
private String qualifiedName;
private String defaultValue;
private String dataType;
private String name;
private String title;
private String required;
private String[] allowedValues;
public RestFormModel onModel()
{
return model;
}
public String[] getAllowedValues()
{
return allowedValues;
}
public void setAllowedValues(String[] allowedValues)
{
this.allowedValues = allowedValues;
}
public String getQualifiedName()
{
return qualifiedName;
}
public void setQualifiedName(String qualifiedName)
{
this.qualifiedName = qualifiedName;
}
public String getDefaultValue()
{
return defaultValue;
}
public void setDefaultValue(String defaultValue)
{
this.defaultValue = defaultValue;
}
public String getDataType()
{
return dataType;
}
public void setDataType(String dataType)
{
this.dataType = dataType;
}
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
public String getTitle()
{
return title;
}
public void setTitle(String title)
{
this.title = title;
}
public String getRequired()
{
return required;
}
public void setRequired(String required)
{
this.required = required;
}
}

View File

@@ -0,0 +1,79 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import static org.alfresco.utility.report.log.Step.STEP;
import java.util.List;
import org.alfresco.rest.core.RestModels;
/**
* Handle collection of <RestFormModel>
* "entries": [
* "entry": {
* "qualifiedName": "{http://www.alfresco.org/model/bpm/1.0}reassignable",
* "defaultValue": "true",
* "dataType": "d:boolean",
* "name": "bpm_reassignable",
* "required": false
* }
* },
* {
* "entry": {
* "allowedValues": [
* "1",
* "2",
* "3"
* ],
* "qualifiedName": "{http://www.alfresco.org/model/bpm/1.0}workflowPriority",
* "defaultValue": "2",
* "dataType": "d:int",
* "name": "bpm_workflowPriority",
* "title": "Workflow Priority",
* "required": false
* }
* },
* ]
* Created by Claudia Agache on 10/18/2016.
*/
public class RestFormModelsCollection extends RestModels<RestFormModel, RestFormModelsCollection>
{
public RestFormModel getStartFormModelByQualifiedName(String qualifiedName)
{
STEP(String.format("REST API: Get start form model by qualified name '%s'", qualifiedName));
List<RestFormModel> startFormModels = getEntries();
for (RestFormModel startFormModel: startFormModels)
{
if (startFormModel.onModel().getQualifiedName().equals(qualifiedName))
{
return startFormModel.onModel();
}
}
return null;
}
}

View File

@@ -0,0 +1,143 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.core.IRestModel;
import org.alfresco.rest.search.RestGenericMetricModel;
import org.alfresco.utility.model.TestModel;
/**
* Generated by 'msuzuki' on '2017-05-15 13:08' from 'Alfresco Search REST API' swagger file
* Generated from 'Alfresco Search REST API' swagger file
* Base Path {@linkplain /alfresco/api/-default-/public/search/versions/1}
*/
public class RestGenericBucketModel extends TestModel implements IRestModel<RestGenericBucketModel>
{
@JsonProperty(value = "entry")
RestGenericBucketModel model;
@Override
public RestGenericBucketModel onModel()
{
return model;
}
/**
The bucket label
*/
private String label;
/**
The filter query you can use to apply this facet
*/
private String filterQuery;
/**
An optional field for additional display information
*/
private Object display;
/**
An array of buckets and values
*/
private List<RestGenericMetricModel> metrics;
/**
Additional list of nested facets
*/
private List<Object> facets;
/**
Additional information of nested facet
*/
private Object facetInfo;
public String getLabel()
{
return this.label;
}
public void setLabel(String label)
{
this.label = label;
}
public String getFilterQuery()
{
return this.filterQuery;
}
public void setFilterQuery(String filterQuery)
{
this.filterQuery = filterQuery;
}
public Object getDisplay()
{
return this.display;
}
public void setDisplay(Object display)
{
this.display = display;
}
public List<RestGenericMetricModel> getMetrics()
{
return this.metrics;
}
public void setMetrics(List<RestGenericMetricModel> metrics)
{
this.metrics = metrics;
}
public List<Object> getFacets()
{
return this.facets;
}
public void setFacets(List<Object> facets)
{
this.facets = facets;
}
public Object getFacetInfo()
{
return this.facetInfo;
}
public void setFacetInfo(Object facetInfo)
{
this.facetInfo = facetInfo;
}
}

View File

@@ -0,0 +1,80 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.core.IRestModel;
import org.alfresco.utility.model.TestModel;
public class RestGroupMember extends TestModel implements IRestModel<RestGroupMember>
{
@JsonProperty(required = true)
private String id;
@JsonProperty(required = true)
private String displayName;
@JsonProperty(required = true)
private String memberType;
@JsonProperty(value = "entry")
RestGroupMember model;
@Override
public RestGroupMember onModel()
{
return model;
}
public String getId()
{
return id;
}
public void setId(String id)
{
this.id = id;
}
public String getDisplayName()
{
return displayName;
}
public void setDisplayName(String displayName)
{
this.displayName = displayName;
}
public String getMemberType()
{
return memberType;
}
public void setMemberType(String memberType)
{
this.memberType = memberType;
}
}

View File

@@ -0,0 +1,32 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import org.alfresco.rest.core.RestModels;
public class RestGroupMemberModelsCollection extends RestModels<RestGroupMember, RestGroupMemberModelsCollection>
{
}

View File

@@ -0,0 +1,107 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import java.util.ArrayList;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.core.IRestModel;
import org.alfresco.utility.model.TestModel;
public class RestGroupsModel extends TestModel implements IRestModel<RestGroupsModel>
{
@JsonProperty(required = true)
private String id;
@JsonProperty(required = true)
private String displayName;
@JsonProperty(required = true)
private Boolean isRoot;
@JsonProperty("parentIds")
private ArrayList<String> parentIds;
@JsonProperty("zones")
private ArrayList<String> zones;
@JsonProperty(value = "entry")
RestGroupsModel model;
@Override
public RestGroupsModel onModel()
{
return model;
}
public String getId()
{
return id;
}
public void setId(String id)
{
this.id = id;
}
public String getDisplayName()
{
return displayName;
}
public void setDisplayName(String displayName)
{
this.displayName = displayName;
}
public Boolean getIsRoot()
{
return isRoot;
}
public void setIsRoot(Boolean isRoot)
{
this.isRoot = isRoot;
}
public ArrayList<String> getParentIds()
{
return parentIds;
}
public void setParentIds(ArrayList<String> parentIds)
{
this.parentIds = parentIds;
}
public ArrayList<String> getZones()
{
return zones;
}
public void setZones(ArrayList<String> zones)
{
this.zones = zones;
}
}

View File

@@ -0,0 +1,32 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import org.alfresco.rest.core.RestModels;
public class RestGroupsModelsCollection extends RestModels<RestGroupsModel, RestGroupsModelsCollection>
{
}

View File

@@ -0,0 +1,79 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import static org.alfresco.utility.report.log.Step.STEP;
import io.restassured.http.Headers;
import io.restassured.response.ResponseBody;
import org.alfresco.utility.Utility;
import org.testng.Assert;
/**
* Created by Claudia Agache on 10/13/2016.
*/
@SuppressWarnings("rawtypes")
public class RestHtmlResponse
{
private Headers headers;
private ResponseBody body;
/**
* @return the {@link ResponseBody}
*/
public ResponseBody getBody()
{
return body;
}
public RestHtmlResponse(Headers headers, ResponseBody body)
{
this.headers = headers;
this.body = body;
}
public void assertResponseContainsImage()
{
STEP("REST API: Assert that response has an image.");
Utility.checkObjectIsInitialized(headers, "Headers");
Utility.checkObjectIsInitialized(body, "Body");
Assert.assertTrue(headers.getValue("content-type").contains("image/png"),
String.format("Content type is not an image. Actual content type is %s", headers.getValue("content-type")));
Assert.assertNotEquals(headers.getValue("content-length"), "0", "Content length should be greater than 0 bytes.");
Assert.assertFalse(body.toString().isEmpty(), "Body should not be empty.");
}
/**
* Assetion that a html element with specific html path has the specified value
*
* @param elementHtmlPath the HTML path of the HTML element
* @param value value of the field
*/
public void assertPathInHtmlBodyEquals(String elementHtmlPath, String value)
{
Assert.assertEquals(body.htmlPath().get(elementHtmlPath), value);
}
}

View File

@@ -0,0 +1,152 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
/*
* 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;
}
}

View File

@@ -0,0 +1,132 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.core.IRestModel;
import org.alfresco.utility.model.TestModel;
/**
*
"entry": {
"createdAt": "2016-10-13T11:21:34.621+0000",
"size": 19,
"createdBy": "admin",
"modifiedAt": "2016-10-13T11:21:38.338+0000",
"name": "file-yCQFYpLniWAzkcR.txt",
"modifiedBy": "User-cchKFZoNIAfZXXn",
"id": "ffb7178f-fc11-41c9-8c40-df6523ad917f",
"mimeType": "text/plain"
}
*
*/
public class RestItemModel extends TestModel implements IRestModel<RestItemModel>
{
@JsonProperty(value = "entry")
RestItemModel model;
@JsonProperty(required = true)
private String createdAt;
private int size;
private String createdBy;
private String modifiedAt;
private String name;
private String modifiedBy;
private String id;
private String mimeType;
@Override
public RestItemModel onModel()
{
return model;
}
public String getCreatedAt()
{
return createdAt;
}
public void setCreatedAt(String createdAt)
{
this.createdAt = createdAt;
}
public int getSize()
{
return size;
}
public void setSize(int size)
{
this.size = size;
}
public String getCreatedBy()
{
return createdBy;
}
public void setCreatedBy(String createdBy)
{
this.createdBy = createdBy;
}
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
public String getModifiedBy()
{
return modifiedBy;
}
public void setModifiedBy(String modifiedBy)
{
this.modifiedBy = modifiedBy;
}
public String getId()
{
return id;
}
public void setId(String id)
{
this.id = id;
}
public String getMimeType()
{
return mimeType;
}
public void setMimeType(String mimeType)
{
this.mimeType = mimeType;
}
public String getModifiedAt()
{
return modifiedAt;
}
public void setModifiedAt(String modifiedAt)
{
this.modifiedAt = modifiedAt;
}
}

View File

@@ -0,0 +1,69 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import org.alfresco.rest.core.RestModels;
import java.util.List;
import static org.alfresco.utility.report.log.Step.STEP;
/**
* Handles collection of Processes
*
* Example:
* "entries": [
{
"entry": {
"createdAt": "2016-10-13T11:21:34.621+0000",
"size": 19,
"createdBy": "admin",
"modifiedAt": "2016-10-13T11:21:38.338+0000",
"name": "file-yCQFYpLniWAzkcR.txt",
"modifiedBy": "User-cchKFZoNIAfZXXn",
"id": "ffb7178f-fc11-41c9-8c40-df6523ad917f",
"mimeType": "text/plain"
}
}
]
*/
public class RestItemModelsCollection extends RestModels<RestItemModel, RestItemModelsCollection>
{
public RestItemModel getProcessItemByName(String name)
{
STEP(String.format("REST API: Get process item entry with name '%s'", name));
List<RestItemModel> processItemsList = getEntries();
for (RestItemModel item: processItemsList)
{
if (item.onModel().getName().equals(name))
{
return item.onModel();
}
}
return null;
}
}

View File

@@ -0,0 +1,127 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.core.IRestModel;
import org.alfresco.utility.model.TestModel;
/**
* Generated by 'aforascu' on '2018-01-10 16:02' from 'Alfresco Content Services REST API' swagger file
* Generated from 'Alfresco Content Services REST API' swagger file
* Base Path {@linkplain /alfresco/api}
*/
public class RestLicenseInfoModel extends TestModel implements IRestModel<RestLicenseInfoModel>
{
@JsonProperty(value = "entry")
RestLicenseInfoModel model;
@Override
public RestLicenseInfoModel onModel()
{
return model;
}
@JsonProperty(required = true)
private String issuedAt;
@JsonProperty(required = true)
private String expiresAt;
@JsonProperty(required = true)
private int remainingDays;
@JsonProperty(required = true)
private String holder;
@JsonProperty(required = true)
private String mode;
private RestEntitlementsInfoModel entitlements;
public String getIssuedAt()
{
return this.issuedAt;
}
public void setIssuedAt(String issuedAt)
{
this.issuedAt = issuedAt;
}
public String getExpiresAt()
{
return this.expiresAt;
}
public void setExpiresAt(String expiresAt)
{
this.expiresAt = expiresAt;
}
public int getRemainingDays()
{
return this.remainingDays;
}
public void setRemainingDays(int remainingDays)
{
this.remainingDays = remainingDays;
}
public String getHolder()
{
return this.holder;
}
public void setHolder(String holder)
{
this.holder = holder;
}
public String getMode()
{
return this.mode;
}
public void setMode(String mode)
{
this.mode = mode;
}
public RestEntitlementsInfoModel getEntitlements()
{
return this.entitlements;
}
public void setEntitlements(RestEntitlementsInfoModel entitlements)
{
this.entitlements = entitlements;
}
}

View File

@@ -0,0 +1,66 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.core.IRestModel;
import org.alfresco.utility.model.TestModel;
/**
* Generated by 'Kristian.Dimitrov@hyland.com' on '2022-07-13 15:53' from 'Alfresco Content Services REST API' swagger file
* Generated from 'Alfresco Content Services REST API' swagger file
* Base Path {@linkplain /alfresco/api/-default-/public/alfresco/versions/1}
*/
public class RestLinkedRuleSetBodyCreateModel extends TestModel implements IRestModel<RestLinkedRuleSetBodyCreateModel>
{
@JsonProperty(value = "entry")
RestLinkedRuleSetBodyCreateModel model;
@Override
public RestLinkedRuleSetBodyCreateModel onModel()
{
return model;
}
/**
Identifier for either the folder or the rule set
*/
@JsonProperty(required = true)
private String id;
public String getId()
{
return this.id;
}
public void setId(String id)
{
this.id = id;
}
}

View File

@@ -0,0 +1,146 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.core.IRestModel;
import org.alfresco.utility.model.TestModel;
/**
* Generated by 'aforascu' on '2018-01-10 16:02' from 'Alfresco Content Services REST API' swagger file
* Generated from 'Alfresco Content Services REST API' swagger file
* Base Path {@linkplain /alfresco/api}
*/
public class RestModuleInfoModel extends TestModel implements IRestModel<RestModuleInfoModel>
{
@JsonProperty(value = "entry")
RestModuleInfoModel model;
@Override
public RestModuleInfoModel onModel()
{
return model;
}
private String id;
private String title;
private String description;
private String version;
private String installDate;
private String installState;
private String versionMin;
private String versionMax;
public String getId()
{
return this.id;
}
public void setId(String id)
{
this.id = id;
}
public String getTitle()
{
return this.title;
}
public void setTitle(String title)
{
this.title = title;
}
public String getDescription()
{
return this.description;
}
public void setDescription(String description)
{
this.description = description;
}
public String getVersion()
{
return this.version;
}
public void setVersion(String version)
{
this.version = version;
}
public String getInstallDate()
{
return this.installDate;
}
public void setInstallDate(String installDate)
{
this.installDate = installDate;
}
public String getInstallState()
{
return this.installState;
}
public void setInstallState(String installState)
{
this.installState = installState;
}
public String getVersionMin()
{
return this.versionMin;
}
public void setVersionMin(String versionMin)
{
this.versionMin = versionMin;
}
public String getVersionMax()
{
return this.versionMax;
}
public void setVersionMax(String versionMax)
{
this.versionMax = versionMax;
}
}

View File

@@ -0,0 +1,91 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import static org.alfresco.utility.report.log.Step.STEP;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.core.IRestModel;
import org.alfresco.utility.model.UserModel;
import org.testng.Assert;
/**
* Created by Cristina Axinte on 9/26/2016.
*
* {
"entry": {
"id": "string",
"homeNetwork": true,
"isEnabled": true,
"createdAt": "2016-09-26T11:33:36.343Z",
"paidNetwork": true,
"subscriptionLevel": "Free",
"quotas": [
{
"id": "string",
"limit": 0,
"usage": 0
}
]
}
}
*
*/
public class RestNetworkModel extends RestPersonNetworkModel implements IRestModel<RestNetworkModel>
{
@JsonProperty(value = "entry")
RestNetworkModel model;
@Override
public RestNetworkModel onModel()
{
return model;
}
public RestNetworkModel assertNetworkHasName(UserModel user)
{
STEP(String.format("REST API: Assert that network has name '%s'", user.getDomain()));
Assert.assertTrue(getId().equalsIgnoreCase(user.getDomain()), "Network doesn't have the expected name.");
return this;
}
public RestNetworkModel assertNetworkIsEnabled()
{
STEP(String.format("REST API: Assert network is enabled"));
Assert.assertEquals(isEnabled(), true, "Network should be enabled.");
return this;
}
public RestNetworkModel assertNetworkIsNotEnabled()
{
STEP(String.format("REST API: Assert that network is disable"));
Assert.assertEquals(isEnabled(), false, "Network should be disabled.");
return this;
}
}

View File

@@ -0,0 +1,32 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import org.alfresco.rest.core.RestModels;
public class RestNetworkModelsCollection extends RestModels<RestNetworkModel, RestNetworkModelsCollection>
{
}

View File

@@ -0,0 +1,86 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.core.IRestModel;
import org.alfresco.utility.model.TestModel;
/**
* Generated by 'pbrodner' on '2016-12-19 14:12' from 'Alfresco Core REST API' swagger file
* Base Path {@linkplain /alfresco/api/-default-/public/alfresco/versions/1}
*/
public class RestNetworkQuotaModel extends TestModel implements IRestModel<RestNetworkQuotaModel>
{
@JsonProperty(value = "entry")
RestNetworkQuotaModel model;
@Override
public RestNetworkQuotaModel onModel()
{
return model;
}
@JsonProperty(required = true)
private String id;
@JsonProperty(required = true)
private int limit;
@JsonProperty(required = true)
private int usage;
public String getId()
{
return this.id;
}
public void setId(String id)
{
this.id = id;
}
public int getLimit()
{
return this.limit;
}
public void setLimit(int limit)
{
this.limit = limit;
}
public int getUsage()
{
return this.usage;
}
public void setUsage(int usage)
{
this.usage = usage;
}
}

View File

@@ -0,0 +1,79 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.core.IRestModel;
import org.alfresco.utility.model.TestModel;
public class RestNodeAssocTargetModel extends TestModel implements IRestModel<RestNodeAssocTargetModel>
{
@JsonProperty(value = "aggregate")
RestNodeAssocTargetModel model;
@JsonProperty(required = true)
private String targetId;
@JsonProperty(required = true)
private String assocType;
public RestNodeAssocTargetModel()
{
}
public RestNodeAssocTargetModel(String targetId, String assocType)
{
this.targetId = targetId;
this.assocType = assocType;
}
@Override
public RestNodeAssocTargetModel onModel()
{
return model;
}
public String getTargetId()
{
return targetId;
}
public void setTargetId(String targetId)
{
this.targetId = targetId;
}
public String getAssocType()
{
return assocType;
}
public void setAssocType(String assocType)
{
this.assocType = assocType;
}
}

View File

@@ -0,0 +1,326 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.core.IRestModel;
import org.alfresco.utility.model.TestModel;
/**
* Created by Andrei Forascu on 30/08/2017.
*/
public class RestNodeAssociationModel extends TestModel implements IRestModel<RestNodeAssociationModel>
{
@JsonProperty(value = "entry")
RestNodeAssociationModel model;
@Override
public RestNodeAssociationModel onModel()
{
return model;
}
@JsonProperty(required = true)
private String id;
/**
* The name must not contain spaces or the following special characters: * " < > \ / ? : and |.
* The character . must not be used at the end of the name.
*/
@JsonProperty(required = true)
private String name;
@JsonProperty(required = true)
private String nodeType;
@JsonProperty(required = true)
private boolean isFolder;
@JsonProperty(required = true)
private boolean isFile;
private boolean isLocked;
@JsonProperty(required = true)
private String modifiedAt;
@JsonProperty(required = true)
private RestByUserModel modifiedByUser;
@JsonProperty(required = true)
private String createdAt;
@JsonProperty
private String archivedAt;
@JsonProperty
private RestByUserModel archivedByUser;
@JsonProperty(required = true)
private RestByUserModel createdByUser;
private String parentId;
private boolean isLink;
private RestContentModel content;
private List<String> aspectNames;
private Object properties;
private List<String> allowableOperations;
private Object path;
private Object permissions;
private RestNodeAssociationTypeModel association;
public RestNodeAssociationTypeModel getAssociation()
{
return association;
}
public void setAssociation(RestNodeAssociationTypeModel association)
{
this.association = association;
}
public RestNodeAssociationModel getModel()
{
return model;
}
public void setModel(RestNodeAssociationModel model)
{
this.model = model;
}
public String getId()
{
return id;
}
public void setId(String id)
{
this.id = id;
}
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
public String getNodeType()
{
return nodeType;
}
public void setNodeType(String nodeType)
{
this.nodeType = nodeType;
}
public boolean isFolder()
{
return isFolder;
}
public void setFolder(boolean isFolder)
{
this.isFolder = isFolder;
}
public boolean isFile()
{
return isFile;
}
public void setFile(boolean isFile)
{
this.isFile = isFile;
}
public boolean isLocked()
{
return isLocked;
}
public void setLocked(boolean isLocked)
{
this.isLocked = isLocked;
}
public String getModifiedAt()
{
return modifiedAt;
}
public void setModifiedAt(String modifiedAt)
{
this.modifiedAt = modifiedAt;
}
public RestByUserModel getModifiedByUser()
{
return modifiedByUser;
}
public void setModifiedByUser(RestByUserModel modifiedByUser)
{
this.modifiedByUser = modifiedByUser;
}
public String getCreatedAt()
{
return createdAt;
}
public void setCreatedAt(String createdAt)
{
this.createdAt = createdAt;
}
public String getArchivedAt()
{
return archivedAt;
}
public void setArchivedAt(String archivedAt)
{
this.archivedAt = archivedAt;
}
public RestByUserModel getArchivedByUser()
{
return archivedByUser;
}
public void setArchivedByUser(RestByUserModel archivedByUser)
{
this.archivedByUser = archivedByUser;
}
public RestByUserModel getCreatedByUser()
{
return createdByUser;
}
public void setCreatedByUser(RestByUserModel createdByUser)
{
this.createdByUser = createdByUser;
}
public String getParentId()
{
return parentId;
}
public void setParentId(String parentId)
{
this.parentId = parentId;
}
public boolean isLink()
{
return isLink;
}
public void setLink(boolean isLink)
{
this.isLink = isLink;
}
public RestContentModel getContent()
{
return content;
}
public void setContent(RestContentModel content)
{
this.content = content;
}
public List<String> getAspectNames()
{
return aspectNames;
}
public void setAspectNames(List<String> aspectNames)
{
this.aspectNames = aspectNames;
}
public Object getProperties()
{
return properties;
}
public void setProperties(Object properties)
{
this.properties = properties;
}
public List<String> getAllowableOperations()
{
return allowableOperations;
}
public void setAllowableOperations(List<String> allowableOperations)
{
this.allowableOperations = allowableOperations;
}
public Object getPath()
{
return path;
}
public void setPath(Object path)
{
this.path = path;
}
public Object getPermissions()
{
return permissions;
}
public void setPermissions(Object permissions)
{
this.permissions = permissions;
}
}

View File

@@ -0,0 +1,33 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.model;
import org.alfresco.rest.core.RestModels;
public class RestNodeAssociationModelCollection extends RestModels<RestNodeAssociationModel, RestNodeAssociationModelCollection>
{
}

Some files were not shown because too many files have changed in this diff Show More