mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[PRODENG-211] integrate JS-API with monorepo (part 1) (#9081)
* integrate JS-API with monorepo * [ci:force] fix token issue [ci:force] migrate docs folder [ci:force] clean personal tokens * [ci:force] gha workflow support * [ci:force] npm publish target * fix js-api test linting * [ci:force] fix test linting, mocks, https scheme * [ci:force] fix https scheme * [ci:force] typescript mappings * [ci:force] update scripts * lint fixes * linting fixes * fix linting * [ci:force] linting fixes * linting fixes * [ci:force] remove js-api upstream and corresponding scripts * [ci:force] jsdoc fixes * fix jsdoc linting * [ci:force] jsdoc fixes * [ci:force] jsdoc fixes * jsdoc fixes * jsdoc fixes * jsdoc fixes * [ci:force] fix jsdoc * [ci:force] reduce code duplication * replace 'chai' expect with node.js assert * replace 'chai' expect with node.js assert * [ci:force] remove chai and chai-spies for js-api testing * [ci:force] cleanup and fix imports * [ci:force] fix linting * [ci:force] fix unit test * [ci:force] fix sonar linting findings * [ci:force] switch activiti api models to interfaces (-2.5% reduction of bundle) * [ci:force] switch activiti api models to interfaces * [ci:force] switch AGS api models to interfaces * [ci:force] switch AGS api models to interfaces * [ci:force] switch search api models to interfaces * [ci:force] switch content api models to interfaces where applicable
This commit is contained in:
1
lib/js-api/test/mockObjects/assets/testFile.txt
Normal file
1
lib/js-api/test/mockObjects/assets/testFile.txt
Normal file
@@ -0,0 +1 @@
|
||||
this is a test upload File.
|
1
lib/js-api/test/mockObjects/assets/testFile2.txt
Normal file
1
lib/js-api/test/mockObjects/assets/testFile2.txt
Normal file
@@ -0,0 +1 @@
|
||||
this is a test form multiple upload File.
|
38
lib/js-api/test/mockObjects/base.mock.ts
Normal file
38
lib/js-api/test/mockObjects/base.mock.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import nock from 'nock';
|
||||
|
||||
export class BaseMock {
|
||||
host: string;
|
||||
|
||||
constructor(host?: string) {
|
||||
this.host = host || 'https://127.0.0.1:8080';
|
||||
}
|
||||
|
||||
put200GenericResponse(scriptSlug: string): void {
|
||||
nock(this.host, { encodedQueryParams: true }).put(scriptSlug).reply(200);
|
||||
}
|
||||
|
||||
play(): void {
|
||||
nock.recorder.play();
|
||||
}
|
||||
|
||||
cleanAll(): void {
|
||||
nock.cleanAll();
|
||||
}
|
||||
}
|
347
lib/js-api/test/mockObjects/content-services/categories.mock.ts
Normal file
347
lib/js-api/test/mockObjects/content-services/categories.mock.ts
Normal file
@@ -0,0 +1,347 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import nock from 'nock';
|
||||
import { BaseMock } from '../base.mock';
|
||||
|
||||
export class CategoriesMock extends BaseMock {
|
||||
get200ResponseSubcategories(categoryId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get(`/alfresco/api/-default-/public/alfresco/versions/1/categories/${categoryId}/subcategories`)
|
||||
.reply(200, {
|
||||
list: {
|
||||
pagination: {
|
||||
count: 2,
|
||||
hasMoreItems: false,
|
||||
totalItems: 2,
|
||||
skipCount: 0,
|
||||
maxItems: 100
|
||||
},
|
||||
entries: [
|
||||
{
|
||||
entry: {
|
||||
id: 'testId1',
|
||||
name: 'testName1',
|
||||
parentId: '-root-',
|
||||
hasChildren: true,
|
||||
count: 0
|
||||
}
|
||||
},
|
||||
{
|
||||
entry: {
|
||||
id: 'testId2',
|
||||
name: 'testName2',
|
||||
parentId: '-root-',
|
||||
hasChildren: true,
|
||||
count: 0
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get404SubcategoryNotExist(categoryId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get(`/alfresco/api/-default-/public/alfresco/versions/1/categories/${categoryId}/subcategories`)
|
||||
.reply(404, {
|
||||
error: {
|
||||
errorKey: 'framework.exception.EntityNotFound',
|
||||
statusCode: 404,
|
||||
briefSummary: `05220073 The entity with id: ${categoryId} was not found`,
|
||||
stackTrace: 'For security reasons the stack trace is no longer displayed, but the property is kept for previous versions.',
|
||||
descriptionURL: 'https://api-explorer.alfresco.com'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get200ResponseCategory(categoryId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get(`/alfresco/api/-default-/public/alfresco/versions/1/categories/${categoryId}`)
|
||||
.reply(200, {
|
||||
entry: {
|
||||
id: 'testId1',
|
||||
name: 'testName1',
|
||||
parentId: '-root-',
|
||||
hasChildren: true,
|
||||
count: 0
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get404CategoryNotExist(categoryId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get(`/alfresco/api/-default-/public/alfresco/versions/1/categories/${categoryId}`)
|
||||
.reply(404, {
|
||||
error: {
|
||||
errorKey: 'framework.exception.EntityNotFound',
|
||||
statusCode: 404,
|
||||
briefSummary: `05220073 The entity with id: ${categoryId} was not found`,
|
||||
stackTrace: 'For security reasons the stack trace is no longer displayed, but the property is kept for previous versions.',
|
||||
descriptionURL: 'https://api-explorer.alfresco.com'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get200ResponseNodeCategoryLinks(nodeId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get(`/alfresco/api/-default-/public/alfresco/versions/1/nodes/${nodeId}/category-links`)
|
||||
.reply(200, {
|
||||
list: {
|
||||
pagination: {
|
||||
count: 1,
|
||||
hasMoreItems: false,
|
||||
totalItems: 1,
|
||||
skipCount: 0,
|
||||
maxItems: 100
|
||||
},
|
||||
entries: [
|
||||
{
|
||||
entry: {
|
||||
id: 'testId1',
|
||||
name: 'testName1',
|
||||
parentId: 'testNode',
|
||||
hasChildren: true,
|
||||
count: 0
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get403NodeCategoryLinksPermissionDenied(nodeId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get(`/alfresco/api/-default-/public/alfresco/versions/1/nodes/${nodeId}/category-links`)
|
||||
.reply(403, {
|
||||
error: {
|
||||
statusCode: 403
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get404NodeNotExist(nodeId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get(`/alfresco/api/-default-/public/alfresco/versions/1/nodes/${nodeId}/category-links`)
|
||||
.reply(404, {
|
||||
error: {
|
||||
errorKey: 'framework.exception.EntityNotFound',
|
||||
statusCode: 404,
|
||||
briefSummary: `05220073 The entity with id: ${nodeId} was not found`,
|
||||
stackTrace: 'For security reasons the stack trace is no longer displayed, but the property is kept for previous versions.',
|
||||
descriptionURL: 'https://api-explorer.alfresco.com'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get204CategoryUnlinked(nodeId: string, categoryId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.delete(`/alfresco/api/-default-/public/alfresco/versions/1/nodes/${nodeId}/category-links/${categoryId}`)
|
||||
.reply(204);
|
||||
}
|
||||
|
||||
get403CategoryUnlinkPermissionDenied(nodeId: string, categoryId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.delete(`/alfresco/api/-default-/public/alfresco/versions/1/nodes/${nodeId}/category-links/${categoryId}`)
|
||||
.reply(403, {
|
||||
error: {
|
||||
statusCode: 403
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get404CategoryUnlinkNotFound(nodeId: string, categoryId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.delete(`/alfresco/api/-default-/public/alfresco/versions/1/nodes/${nodeId}/category-links/${categoryId}`)
|
||||
.reply(404, {
|
||||
error: {
|
||||
errorKey: 'framework.exception.EntityNotFound',
|
||||
statusCode: 404,
|
||||
briefSummary: `05230078 The entity with id: ${nodeId} or ${categoryId} was not found`,
|
||||
stackTrace: 'For security reasons the stack trace is no longer displayed, but the property is kept for previous versions.',
|
||||
descriptionURL: 'https://api-explorer.alfresco.com'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get200ResponseCategoryUpdated(categoryId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.put(`/alfresco/api/-default-/public/alfresco/versions/1/categories/${categoryId}`, { name: 'testName1' })
|
||||
.reply(200, {
|
||||
entry: {
|
||||
id: 'testId1',
|
||||
name: 'testName1',
|
||||
parentId: '-root-',
|
||||
hasChildren: true,
|
||||
count: 0
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get403CategoryUpdatePermissionDenied(categoryId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.put(`/alfresco/api/-default-/public/alfresco/versions/1/categories/${categoryId}`, { name: 'testName1' })
|
||||
.reply(403, {
|
||||
error: {
|
||||
statusCode: 403
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get404CategoryUpdateNotFound(categoryId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.put(`/alfresco/api/-default-/public/alfresco/versions/1/categories/${categoryId}`, { name: 'testName1' })
|
||||
.reply(404, {
|
||||
error: {
|
||||
errorKey: 'framework.exception.EntityNotFound',
|
||||
statusCode: 404,
|
||||
briefSummary: `05230078 The entity with id: ${categoryId} was not found`,
|
||||
stackTrace: 'For security reasons the stack trace is no longer displayed, but the property is kept for previous versions.',
|
||||
descriptionURL: 'https://api-explorer.alfresco.com'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get201ResponseCategoryCreated(categoryId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.post(`/alfresco/api/-default-/public/alfresco/versions/1/categories/${categoryId}/subcategories`, [{ name: 'testName10' }])
|
||||
.reply(201, {
|
||||
entry: {
|
||||
id: 'testId10',
|
||||
name: 'testName10',
|
||||
parentId: categoryId,
|
||||
hasChildren: true,
|
||||
count: 0
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get403CategoryCreatedPermissionDenied(categoryId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.post(`/alfresco/api/-default-/public/alfresco/versions/1/categories/${categoryId}/subcategories`, [{ name: 'testName10' }])
|
||||
.reply(403, {
|
||||
error: {
|
||||
statusCode: 403
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get409CategoryCreateAlreadyExists(categoryId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.post(`/alfresco/api/-default-/public/alfresco/versions/1/categories/${categoryId}/subcategories`, [{ name: 'testName10' }])
|
||||
.reply(409, {
|
||||
error: {
|
||||
errorKey: 'Duplicate child name not allowed: testName10',
|
||||
statusCode: 409,
|
||||
briefSummary: '06050055 Duplicate child name not allowed: testName10',
|
||||
stackTrace: 'For security reasons the stack trace is no longer displayed, but the property is kept for previous versions.',
|
||||
descriptionURL: 'https://api-explorer.alfresco.com'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get201ResponseCategoryLinked(nodeId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.post(`/alfresco/api/-default-/public/alfresco/versions/1/nodes/${nodeId}/category-links`, [{ categoryId: 'testId1' }])
|
||||
.reply(201, {
|
||||
entry: {
|
||||
id: 'testId1',
|
||||
name: 'testName1',
|
||||
parentId: nodeId,
|
||||
hasChildren: true,
|
||||
count: 0
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get201ResponseCategoryLinkedArray(nodeId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.post(`/alfresco/api/-default-/public/alfresco/versions/1/nodes/${nodeId}/category-links`, [
|
||||
{ categoryId: 'testId1' },
|
||||
{ categoryId: 'testId2' }
|
||||
])
|
||||
.reply(201, {
|
||||
list: {
|
||||
pagination: {
|
||||
count: 2,
|
||||
hasMoreItems: false,
|
||||
totalItems: 2,
|
||||
skipCount: 0,
|
||||
maxItems: 100
|
||||
},
|
||||
entries: [
|
||||
{
|
||||
entry: {
|
||||
id: 'testId1',
|
||||
name: 'testName1',
|
||||
parentId: 'testNodeArr',
|
||||
hasChildren: true,
|
||||
count: 0
|
||||
}
|
||||
},
|
||||
{
|
||||
entry: {
|
||||
id: 'testId2',
|
||||
name: 'testName2',
|
||||
parentId: 'testNodeArr',
|
||||
hasChildren: true,
|
||||
count: 0
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get403CategoryLinkPermissionDenied(nodeId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.post(`/alfresco/api/-default-/public/alfresco/versions/1/nodes/${nodeId}/category-links`, [{ categoryId: 'testId1' }])
|
||||
.reply(403, {
|
||||
error: {
|
||||
statusCode: 403
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get404CategoryLinkNotFound(nodeId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.post(`/alfresco/api/-default-/public/alfresco/versions/1/nodes/${nodeId}/category-links`, [{ categoryId: 'testId1' }])
|
||||
.reply(404, {
|
||||
error: {
|
||||
errorKey: 'framework.exception.EntityNotFound',
|
||||
statusCode: 404,
|
||||
briefSummary: `05230078 The entity with id: ${nodeId} or testId1 was not found`,
|
||||
stackTrace: 'For security reasons the stack trace is no longer displayed, but the property is kept for previous versions.',
|
||||
descriptionURL: 'https://api-explorer.alfresco.com'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get405CategoryLinkCannotAssign(nodeId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.post(`/alfresco/api/-default-/public/alfresco/versions/1/nodes/${nodeId}/category-links`, [{ categoryId: 'testId1' }])
|
||||
.reply(405, {
|
||||
error: {
|
||||
errorKey: 'Cannot assign node of this type to a category',
|
||||
statusCode: 405,
|
||||
briefSummary: `05230078 Cannot assign a node of this type to a category`,
|
||||
stackTrace: 'For security reasons the stack trace is no longer displayed, but the property is kept for previous versions.',
|
||||
descriptionURL: 'https://api-explorer.alfresco.com'
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
105
lib/js-api/test/mockObjects/content-services/comment.mock.ts
Normal file
105
lib/js-api/test/mockObjects/content-services/comment.mock.ts
Normal file
@@ -0,0 +1,105 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import nock from 'nock';
|
||||
import { BaseMock } from '../base.mock';
|
||||
|
||||
const adminUser = {
|
||||
aspectNames: ['cm:ownable'],
|
||||
firstName: 'Administrator',
|
||||
emailNotificationsEnabled: true,
|
||||
company: {},
|
||||
id: 'admin',
|
||||
enabled: true,
|
||||
email: 'admin@alfresco.com',
|
||||
properties: {
|
||||
'cm:homeFolderProvider': 'bootstrapHomeFolderProvider',
|
||||
'cm:authorizationStatus': 'AUTHORIZED',
|
||||
'cm:homeFolder': '72866d2e-64ee-45a2-ae00-30a5ced96a41',
|
||||
'cm:name': '56f78250-37a7-4e22-b35a-64b53ae1e5ca',
|
||||
'cm:owner': { id: 'admin', displayName: 'Administrator' },
|
||||
'cm:organizationId': ''
|
||||
}
|
||||
};
|
||||
|
||||
export class CommentMock extends BaseMock {
|
||||
post201Response(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.post('/alfresco/api/-default-/public/alfresco/versions/1/nodes/74cd8a96-8a21-47e5-9b3b-a1b3e296787d/comments', {
|
||||
content: 'This is a comment'
|
||||
})
|
||||
.reply(201, {
|
||||
entry: {
|
||||
createdAt: '2017-04-11T09:31:21.452+0000',
|
||||
createdBy: adminUser,
|
||||
edited: false,
|
||||
modifiedAt: '2017-04-11T09:31:21.452+0000',
|
||||
canEdit: true,
|
||||
modifiedBy: adminUser,
|
||||
canDelete: true,
|
||||
id: 'c294cf79-49c1-483e-ac86-39c8fe3cce8f',
|
||||
content: 'This is a comment'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get200Response(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get('/alfresco/api/-default-/public/alfresco/versions/1/nodes/74cd8a96-8a21-47e5-9b3b-a1b3e296787d/comments')
|
||||
.reply(200, {
|
||||
list: {
|
||||
pagination: {
|
||||
count: 2,
|
||||
hasMoreItems: false,
|
||||
totalItems: 2,
|
||||
skipCount: 0,
|
||||
maxItems: 100
|
||||
},
|
||||
entries: [
|
||||
{
|
||||
entry: {
|
||||
createdAt: '2017-04-11T09:31:21.658+0000',
|
||||
createdBy: adminUser,
|
||||
edited: false,
|
||||
modifiedAt: '2017-04-11T09:31:21.658+0000',
|
||||
canEdit: true,
|
||||
modifiedBy: adminUser,
|
||||
canDelete: true,
|
||||
id: '539fc9b2-7d5b-4966-9e44-fcf433647f25',
|
||||
content: 'This is another comment'
|
||||
}
|
||||
},
|
||||
{
|
||||
entry: {
|
||||
createdAt: '2017-04-11T09:31:21.452+0000',
|
||||
createdBy: adminUser,
|
||||
edited: false,
|
||||
modifiedAt: '2017-04-11T09:31:21.452+0000',
|
||||
canEdit: true,
|
||||
modifiedBy: adminUser,
|
||||
canDelete: true,
|
||||
id: 'c294cf79-49c1-483e-ac86-39c8fe3cce8f',
|
||||
content: 'This is a comment'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@@ -0,0 +1,69 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import nock from 'nock';
|
||||
import { BaseMock } from '../base.mock';
|
||||
|
||||
export class CustomModelMock extends BaseMock {
|
||||
get200AllCustomModel(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get('/alfresco/api/-default-/private/alfresco/versions/1/cmm')
|
||||
.reply(200, {
|
||||
list: {
|
||||
pagination: {
|
||||
count: 0,
|
||||
hasMoreItems: false,
|
||||
totalItems: 0,
|
||||
skipCount: 0,
|
||||
maxItems: 100
|
||||
},
|
||||
entries: []
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
create201CustomModel(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.post('/alfresco/api/-default-/private/alfresco/versions/1/cmm')
|
||||
.reply(201, {
|
||||
entry: {
|
||||
author: 'Administrator',
|
||||
name: 'testModel',
|
||||
description: 'Test model description',
|
||||
namespaceUri: 'https://www.alfresco.org/model/testNamespace/1.0',
|
||||
namespacePrefix: 'test',
|
||||
status: 'DRAFT'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
activateCustomModel200(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.put('/alfresco/api/-default-/private/alfresco/versions/1/cmm/testModel', { status: 'ACTIVE' })
|
||||
.query({ select: 'status' })
|
||||
.reply(200, {
|
||||
entry: {
|
||||
author: 'Administrator',
|
||||
name: 'testModel',
|
||||
description: 'Test model description',
|
||||
namespaceUri: 'https://www.alfresco.org/model/testNamespace/1.0',
|
||||
namespacePrefix: 'test',
|
||||
status: 'ACTIVE'
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@@ -0,0 +1,86 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import nock from 'nock';
|
||||
import { BaseMock } from '../base.mock';
|
||||
|
||||
export class DiscoveryMock extends BaseMock {
|
||||
get200Response(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get('/alfresco/api/discovery')
|
||||
.reply(200, {
|
||||
entry: {
|
||||
repository: {
|
||||
edition: 'Enterprise',
|
||||
version: {
|
||||
major: '5',
|
||||
minor: '2',
|
||||
patch: '1',
|
||||
hotfix: '0',
|
||||
schema: 10052,
|
||||
label: 'r133188-b433',
|
||||
display: '5.2.1.0 (r133188-b433) schema 10052'
|
||||
},
|
||||
license: {
|
||||
issuedAt: '2017-04-10T10:45:00.177+0000',
|
||||
expiresAt: '2017-05-10T00:00:00.000+0000',
|
||||
remainingDays: 16,
|
||||
holder: 'Trial User',
|
||||
mode: 'ENTERPRISE',
|
||||
entitlements: { isClusterEnabled: false, isCryptodocEnabled: false }
|
||||
},
|
||||
status: {
|
||||
isReadOnly: false,
|
||||
isAuditEnabled: true,
|
||||
isQuickShareEnabled: true,
|
||||
isThumbnailGenerationEnabled: true
|
||||
},
|
||||
modules: [
|
||||
{
|
||||
id: 'alfresco-share-services',
|
||||
title: 'Alfresco Share Services AMP',
|
||||
description: 'Module to be applied to alfresco.war, containing APIs for Alfresco Share',
|
||||
version: '5.2.0',
|
||||
installDate: '2016-11-28T18:59:22.555+0000',
|
||||
installState: 'INSTALLED',
|
||||
versionMin: '5.1',
|
||||
versionMax: '999'
|
||||
},
|
||||
{
|
||||
id: 'alfresco-trashcan-cleaner',
|
||||
title: 'alfresco-trashcan-cleaner project',
|
||||
description: 'The Alfresco Trash Can Cleaner (Alfresco Module)',
|
||||
version: '2.2',
|
||||
installState: 'UNKNOWN',
|
||||
versionMin: '0',
|
||||
versionMax: '999'
|
||||
},
|
||||
{
|
||||
id: 'enablecors',
|
||||
title: 'Enable Cors support',
|
||||
description: 'Adds a web-fragment with the filter config for Cors support',
|
||||
version: '1.0-SNAPSHOT',
|
||||
installState: 'UNKNOWN',
|
||||
versionMin: '0',
|
||||
versionMax: '999'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
108
lib/js-api/test/mockObjects/content-services/ecm-auth.mock.ts
Normal file
108
lib/js-api/test/mockObjects/content-services/ecm-auth.mock.ts
Normal file
@@ -0,0 +1,108 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import nock from 'nock';
|
||||
import { BaseMock } from '../base.mock';
|
||||
|
||||
export class EcmAuthMock extends BaseMock {
|
||||
username: string;
|
||||
password: string;
|
||||
|
||||
constructor(host?: string, username?: string, password?: string) {
|
||||
super(host);
|
||||
this.username = username || 'admin';
|
||||
this.password = password || 'admin';
|
||||
}
|
||||
|
||||
get201Response(forceTicket?: string): void {
|
||||
const returnMockTicket = forceTicket || 'TICKET_4479f4d3bb155195879bfbb8d5206f433488a1b1';
|
||||
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.post('/alfresco/api/-default-/public/authentication/versions/1/tickets', {
|
||||
userId: this.username,
|
||||
password: this.password
|
||||
})
|
||||
.reply(201, { entry: { id: returnMockTicket, userId: 'admin' } });
|
||||
}
|
||||
|
||||
get200ValidTicket(forceTicket?: string): void {
|
||||
const returnMockTicket = forceTicket || 'TICKET_4479f4d3bb155195879bfbb8d5206f433488a1b1';
|
||||
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get('/alfresco/api/-default-/public/authentication/versions/1/tickets/-me-')
|
||||
.reply(200, { entry: { id: returnMockTicket } });
|
||||
}
|
||||
|
||||
get403Response(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.post('/alfresco/api/-default-/public/authentication/versions/1/tickets', {
|
||||
userId: 'wrong',
|
||||
password: 'name'
|
||||
})
|
||||
.reply(403, {
|
||||
error: {
|
||||
errorKey: 'Login failed',
|
||||
statusCode: 403,
|
||||
briefSummary: '05150009 Login failed',
|
||||
stackTrace: 'For security reasons the stack trace is no longer displayed, but the property is kept for previous versions.',
|
||||
descriptionURL: 'https://api-explorer.alfresco.com'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get400Response(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.post('/alfresco/api/-default-/public/authentication/versions/1/tickets', {
|
||||
userId: null,
|
||||
password: null
|
||||
})
|
||||
.reply(400, {
|
||||
error: {
|
||||
errorKey: 'Invalid login details.',
|
||||
statusCode: 400,
|
||||
briefSummary: '05160045 Invalid login details.',
|
||||
stackTrace: 'For security reasons the stack trace is no longer displayed, but the property is kept for previous versions.',
|
||||
descriptionURL: 'https://api-explorer.alfresco.com'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get401Response(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.post('/alfresco/api/-default-/public/authentication/versions/1/tickets', {
|
||||
userId: 'wrong',
|
||||
password: 'name'
|
||||
})
|
||||
.reply(401, {
|
||||
error: {
|
||||
errorKey: 'framework.exception.ApiDefault',
|
||||
statusCode: 401,
|
||||
briefSummary: '05210059 Authentication failed for Web Script org/alfresco/api/ResourceWebScript.get',
|
||||
stackTrace: 'For security reasons the stack trace is no longer displayed, but the property is kept for previous versions.',
|
||||
descriptionURL: 'https://api-explorer.alfresco.com'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get204ResponseLogout(): void {
|
||||
nock(this.host, { encodedQueryParams: true }).delete('/alfresco/api/-default-/public/authentication/versions/1/tickets/-me-').reply(204, '');
|
||||
}
|
||||
|
||||
get404ResponseLogout(): void {
|
||||
nock(this.host, { encodedQueryParams: true }).delete('/alfresco/api/-default-/public/authentication/versions/1/tickets/-me-').reply(404, '');
|
||||
}
|
||||
}
|
@@ -0,0 +1,93 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import nock from 'nock';
|
||||
import { BaseMock } from '../base.mock';
|
||||
|
||||
export class FindNodesMock extends BaseMock {
|
||||
get200Response(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get('/alfresco/api/-default-/public/alfresco/versions/1/queries/nodes?term=test')
|
||||
.reply(200, {
|
||||
list: {
|
||||
pagination: {
|
||||
count: 2,
|
||||
hasMoreItems: false,
|
||||
totalItems: 2,
|
||||
skipCount: 0,
|
||||
maxItems: 100
|
||||
},
|
||||
entries: [
|
||||
{
|
||||
entry: {
|
||||
createdAt: '2011-03-03T10:34:52.092+0000',
|
||||
isFolder: false,
|
||||
isFile: true,
|
||||
createdByUser: { id: 'abeecher', displayName: 'Alice Beecher' },
|
||||
modifiedAt: '2011-03-03T10:34:52.092+0000',
|
||||
modifiedByUser: { id: 'abeecher', displayName: 'Alice Beecher' },
|
||||
name: 'coins1.JPG',
|
||||
id: '7bb9c846-fcc5-43b5-a893-39e46ebe94d4',
|
||||
nodeType: 'cm:content',
|
||||
content: {
|
||||
mimeType: 'image/jpeg',
|
||||
mimeTypeName: 'JPEG Image',
|
||||
sizeInBytes: 501641,
|
||||
encoding: 'UTF-8'
|
||||
},
|
||||
parentId: '880a0f47-31b1-4101-b20b-4d325e54e8b1'
|
||||
}
|
||||
},
|
||||
{
|
||||
entry: {
|
||||
createdAt: '2011-03-03T10:34:52.092+0000',
|
||||
isFolder: false,
|
||||
isFile: true,
|
||||
createdByUser: { id: 'abeecher', displayName: 'Alice Beecher' },
|
||||
modifiedAt: '2011-03-03T10:34:52.092+0000',
|
||||
modifiedByUser: { id: 'abeecher', displayName: 'Alice Beecher' },
|
||||
name: 'coins2.JPG',
|
||||
id: '7bb9c846-fcc5-43b5-a893-39e46ebe94d4',
|
||||
nodeType: 'cm:content',
|
||||
content: {
|
||||
mimeType: 'image/jpeg',
|
||||
mimeTypeName: 'JPEG Image',
|
||||
sizeInBytes: 501641,
|
||||
encoding: 'UTF-8'
|
||||
},
|
||||
parentId: '880a0f47-31b1-4101-b20b-4d325e54e8b1'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get401Response(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get('/alfresco/api/-default-/public/alfresco/versions/1/queries/nodes?term=test')
|
||||
.reply(401, {
|
||||
error: {
|
||||
errorKey: 'framework.exception.ApiDefault',
|
||||
statusCode: 401,
|
||||
briefSummary: '05210059 Authentication failed for Web Script org/alfresco/api/ResourceWebScript.get',
|
||||
stackTrace: 'For security reasons the stack trace is no longer displayed, but the property is kept for previous versions.',
|
||||
descriptionURL: 'https://api-explorer.alfresco.com'
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
139
lib/js-api/test/mockObjects/content-services/groups.mock.ts
Normal file
139
lib/js-api/test/mockObjects/content-services/groups.mock.ts
Normal file
@@ -0,0 +1,139 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import nock from 'nock';
|
||||
import { BaseMock } from '../base.mock';
|
||||
|
||||
export class GroupsMock extends BaseMock {
|
||||
get200GetGroups(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get('/alfresco/api/-default-/public/alfresco/versions/1/groups')
|
||||
.reply(200, {
|
||||
list: {
|
||||
pagination: {
|
||||
count: 2,
|
||||
hasMoreItems: true,
|
||||
totalItems: 279,
|
||||
skipCount: 0,
|
||||
maxItems: 2
|
||||
},
|
||||
entries: [
|
||||
{
|
||||
entry: {
|
||||
isRoot: true,
|
||||
displayName: 'alfalfb',
|
||||
id: 'GROUP_alfalfa'
|
||||
}
|
||||
},
|
||||
{
|
||||
entry: {
|
||||
isRoot: true,
|
||||
displayName: 'Call CenterAA',
|
||||
id: 'GROUP_CallCenterAA'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
getDeleteGroupSuccessfulResponse(groupName: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.delete('/alfresco/api/-default-/public/alfresco/versions/1/groups/' + groupName)
|
||||
.query({ cascade: 'false' })
|
||||
.reply(200);
|
||||
}
|
||||
|
||||
getDeleteMemberForGroupSuccessfulResponse(groupName: string, memberName: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.delete('/alfresco/api/-default-/public/alfresco/versions/1/groups/' + groupName + '/members/' + memberName)
|
||||
.reply(200);
|
||||
}
|
||||
|
||||
get200CreateGroupResponse(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.post('/alfresco/api/-default-/public/alfresco/versions/1/groups')
|
||||
.reply(200, {
|
||||
entry: {
|
||||
isRoot: true,
|
||||
displayName: 'SAMPLE',
|
||||
id: 'GROUP_TEST'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get200GetSingleGroup(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get('/alfresco/api/-default-/public/alfresco/versions/1/groups/GROUP_TEST')
|
||||
.reply(200, {
|
||||
entry: {
|
||||
isRoot: true,
|
||||
displayName: 'SAMPLE',
|
||||
id: 'GROUP_TEST'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get200UpdateGroupResponse(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.put('/alfresco/api/-default-/public/alfresco/versions/1/groups/GROUP_TEST')
|
||||
.reply(200, {
|
||||
entry: {
|
||||
isRoot: true,
|
||||
displayName: 'CHANGED',
|
||||
id: 'GROUP_TEST'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get200GetGroupMemberships(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get('/alfresco/api/-default-/public/alfresco/versions/1/groups/GROUP_TEST/members')
|
||||
.reply(200, {
|
||||
list: {
|
||||
pagination: {
|
||||
count: 1,
|
||||
hasMoreItems: false,
|
||||
totalItems: 1,
|
||||
skipCount: 0,
|
||||
maxItems: 100
|
||||
},
|
||||
entries: [
|
||||
{
|
||||
entry: {
|
||||
displayName: 'SAMPLE',
|
||||
id: 'GROUP_SUB_TEST',
|
||||
memberType: 'GROUP'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get200AddGroupMembershipResponse(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.post('/alfresco/api/-default-/public/alfresco/versions/1/groups/GROUP_TEST/members')
|
||||
.reply(200, {
|
||||
entry: {
|
||||
displayName: 'SAMPLE',
|
||||
id: 'GROUP_SUB_TEST',
|
||||
memberType: 'GROUP'
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
233
lib/js-api/test/mockObjects/content-services/node.mock.ts
Normal file
233
lib/js-api/test/mockObjects/content-services/node.mock.ts
Normal file
@@ -0,0 +1,233 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import nock from 'nock';
|
||||
import { BaseMock } from '../base.mock';
|
||||
|
||||
export class NodeMock extends BaseMock {
|
||||
get200ResponseChildren(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get('/alfresco/api/-default-/public/alfresco/versions/1/nodes/b4cff62a-664d-4d45-9302-98723eac1319/children')
|
||||
.reply(200, {
|
||||
list: {
|
||||
pagination: {
|
||||
count: 5,
|
||||
hasMoreItems: false,
|
||||
totalItems: 5,
|
||||
skipCount: 0,
|
||||
maxItems: 100
|
||||
},
|
||||
entries: [
|
||||
{
|
||||
entry: {
|
||||
createdAt: '2011-02-15T20:19:00.007+0000',
|
||||
isFolder: true,
|
||||
isFile: false,
|
||||
createdByUser: { id: 'mjackson', displayName: 'Mike Jackson' },
|
||||
modifiedAt: '2011-02-15T20:19:00.007+0000',
|
||||
modifiedByUser: { id: 'mjackson', displayName: 'Mike Jackson' },
|
||||
name: 'dataLists',
|
||||
id: '64f69e69-f61e-42a3-8697-95eea1f2bda2',
|
||||
nodeType: 'cm:folder',
|
||||
parentId: 'b4cff62a-664d-4d45-9302-98723eac1319'
|
||||
}
|
||||
},
|
||||
{
|
||||
entry: {
|
||||
createdAt: '2011-02-15T22:04:54.290+0000',
|
||||
isFolder: true,
|
||||
isFile: false,
|
||||
createdByUser: { id: 'mjackson', displayName: 'Mike Jackson' },
|
||||
modifiedAt: '2011-02-15T22:04:54.290+0000',
|
||||
modifiedByUser: { id: 'mjackson', displayName: 'Mike Jackson' },
|
||||
name: 'discussions',
|
||||
id: '059c5bc7-2d38-4dc5-96b8-d09cd3c69b4c',
|
||||
nodeType: 'cm:folder',
|
||||
parentId: 'b4cff62a-664d-4d45-9302-98723eac1319'
|
||||
}
|
||||
},
|
||||
{
|
||||
entry: {
|
||||
createdAt: '2011-02-15T20:16:28.292+0000',
|
||||
isFolder: true,
|
||||
isFile: false,
|
||||
createdByUser: { id: 'mjackson', displayName: 'Mike Jackson' },
|
||||
modifiedAt: '2016-06-27T14:31:10.007+0000',
|
||||
modifiedByUser: { id: 'admin', displayName: 'Administrator' },
|
||||
name: 'documentLibrary',
|
||||
id: '8f2105b4-daaf-4874-9e8a-2152569d109b',
|
||||
nodeType: 'cm:folder',
|
||||
parentId: 'b4cff62a-664d-4d45-9302-98723eac1319'
|
||||
}
|
||||
},
|
||||
{
|
||||
entry: {
|
||||
createdAt: '2011-02-15T20:18:59.808+0000',
|
||||
isFolder: true,
|
||||
isFile: false,
|
||||
createdByUser: { id: 'mjackson', displayName: 'Mike Jackson' },
|
||||
modifiedAt: '2011-02-15T20:18:59.808+0000',
|
||||
modifiedByUser: { id: 'mjackson', displayName: 'Mike Jackson' },
|
||||
name: 'links',
|
||||
id: '0e24b99c-41f0-43e1-a55e-fb9f50d73820',
|
||||
nodeType: 'cm:folder',
|
||||
parentId: 'b4cff62a-664d-4d45-9302-98723eac1319'
|
||||
}
|
||||
},
|
||||
{
|
||||
entry: {
|
||||
createdAt: '2011-02-15T21:46:01.603+0000',
|
||||
isFolder: true,
|
||||
isFile: false,
|
||||
createdByUser: { id: 'mjackson', displayName: 'Mike Jackson' },
|
||||
modifiedAt: '2011-02-15T21:46:01.603+0000',
|
||||
modifiedByUser: { id: 'mjackson', displayName: 'Mike Jackson' },
|
||||
name: 'wiki',
|
||||
id: 'cdefb3a9-8f55-4771-a9e3-06fa370250f6',
|
||||
nodeType: 'cm:folder',
|
||||
parentId: 'b4cff62a-664d-4d45-9302-98723eac1319'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get200ResponseChildrenNonUTCTimes(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get('/alfresco/api/-default-/public/alfresco/versions/1/nodes/b4cff62a-664d-4d45-9302-98723eac1320/children')
|
||||
.reply(200, {
|
||||
list: {
|
||||
pagination: {
|
||||
count: 5,
|
||||
hasMoreItems: false,
|
||||
totalItems: 5,
|
||||
skipCount: 0,
|
||||
maxItems: 100
|
||||
},
|
||||
entries: [
|
||||
{
|
||||
entry: {
|
||||
createdAt: '2011-03-15T12:04:54.290-0500',
|
||||
isFolder: true,
|
||||
isFile: false,
|
||||
createdByUser: { id: 'mjackson', displayName: 'Mike Jackson' },
|
||||
modifiedAt: '2011-03-15T12:04:54.290-0500',
|
||||
modifiedByUser: { id: 'mjackson', displayName: 'Mike Jackson' },
|
||||
name: 'discussions',
|
||||
id: '059c5bc7-2d38-4dc5-96b8-d09cd3c69b4c',
|
||||
nodeType: 'cm:folder',
|
||||
parentId: 'b4cff62a-664d-4d45-9302-98723eac1320'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get404ChildrenNotExist(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get('/alfresco/api/-default-/public/alfresco/versions/1/nodes/b4cff62a-664d-4d45-9302-98723eac1319/children')
|
||||
.reply(404, {
|
||||
error: {
|
||||
errorKey: 'framework.exception.EntityNotFound',
|
||||
statusCode: 404,
|
||||
briefSummary: '05220073 The entity with id: 80a94ac4-3ec4-47ad-864e-5d939424c47c was not found',
|
||||
stackTrace: 'For security reasons the stack trace is no longer displayed, but the property is kept for previous versions.',
|
||||
descriptionURL: 'https://api-explorer.alfresco.com'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get401CreationFolder(): void {
|
||||
nock(this.host, { encodedQueryParams: true }).post('/alfresco/api/-default-/public/alfresco/versions/1/nodes/-root-/children').reply(401);
|
||||
}
|
||||
|
||||
get204SuccessfullyDeleted(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.delete('/alfresco/api/-default-/public/alfresco/versions/1/nodes/80a94ac8-3ece-47ad-864e-5d939424c47c')
|
||||
.reply(204);
|
||||
}
|
||||
|
||||
get403DeletePermissionDenied(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.delete('/alfresco/api/-default-/public/alfresco/versions/1/nodes/80a94ac8-3ece-47ad-864e-5d939424c47c')
|
||||
.reply(403);
|
||||
}
|
||||
|
||||
get404DeleteNotFound(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.delete('/alfresco/api/-default-/public/alfresco/versions/1/nodes/80a94ac8-test-47ad-864e-5d939424c47c')
|
||||
.reply(404, {
|
||||
error: {
|
||||
errorKey: 'framework.exception.EntityNotFound',
|
||||
statusCode: 404,
|
||||
briefSummary: '05230078 The entity with id: 80a94ac8-test-47ad-864e-5d939424c47c was not found',
|
||||
stackTrace: 'For security reasons the stack trace is no longer displayed, but the property is kept for previous versions.',
|
||||
descriptionURL: 'https://api-explorer.alfresco.com'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get200ResponseChildrenFutureNewPossibleValue(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get('/alfresco/api/-default-/public/alfresco/versions/1/nodes/b4cff62a-664d-4d45-9302-98723eac1319/children')
|
||||
.reply(200, {
|
||||
list: {
|
||||
pagination: {
|
||||
count: 2,
|
||||
hasMoreItems: false,
|
||||
totalItems: 2,
|
||||
skipCount: 0,
|
||||
maxItems: 100
|
||||
},
|
||||
entries: [
|
||||
{
|
||||
entry: {
|
||||
createdAt: '2011-02-15T20:19:00.007+0000',
|
||||
isFolder: true,
|
||||
isFile: false,
|
||||
createdByUser: { id: 'mjackson', displayName: 'Mike Jackson' },
|
||||
modifiedAt: '2011-02-15T20:19:00.007+0000',
|
||||
modifiedByUser: { id: 'mjackson', displayName: 'Mike Jackson' },
|
||||
name: 'dataLists',
|
||||
id: '64f69e69-f61e-42a3-8697-95eea1f2bda2',
|
||||
nodeType: 'cm:folder',
|
||||
parentId: 'b4cff62a-664d-4d45-9302-98723eac1319',
|
||||
impossibleProperties: 'impossibleRightValue'
|
||||
}
|
||||
},
|
||||
{
|
||||
entry: {
|
||||
createdAt: '2011-02-15T22:04:54.290+0000',
|
||||
isFolder: true,
|
||||
isFile: false,
|
||||
createdByUser: { id: 'mjackson', displayName: 'Mike Jackson' },
|
||||
modifiedAt: '2011-02-15T22:04:54.290+0000',
|
||||
modifiedByUser: { id: 'mjackson', displayName: 'Mike Jackson' },
|
||||
name: 'discussions',
|
||||
id: '059c5bc7-2d38-4dc5-96b8-d09cd3c69b4c',
|
||||
nodeType: 'cm:folder',
|
||||
parentId: 'b4cff62a-664d-4d45-9302-98723eac1319',
|
||||
impossibleProperties: 'impossibleRightValue'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
115
lib/js-api/test/mockObjects/content-services/people.mock.ts
Normal file
115
lib/js-api/test/mockObjects/content-services/people.mock.ts
Normal file
@@ -0,0 +1,115 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import nock from 'nock';
|
||||
import { BaseMock } from '../base.mock';
|
||||
|
||||
export class PeopleMock extends BaseMock {
|
||||
get201Response(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.post('/alfresco/api/-default-/public/alfresco/versions/1/people')
|
||||
.reply(201, {
|
||||
entry: {
|
||||
firstName: 'chewbacca',
|
||||
lastName: 'Chewbe',
|
||||
emailNotificationsEnabled: true,
|
||||
company: {},
|
||||
id: 'chewbe',
|
||||
enabled: true,
|
||||
email: 'chewbe@millenniumfalcon.com'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get200ResponsePersons(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get('/alfresco/api/-default-/public/alfresco/versions/1/people')
|
||||
.reply(200, {
|
||||
list: {
|
||||
pagination: {
|
||||
count: 5,
|
||||
hasMoreItems: true,
|
||||
totalItems: 153,
|
||||
skipCount: 0,
|
||||
maxItems: 5
|
||||
},
|
||||
entries: [
|
||||
{
|
||||
entry: {
|
||||
firstName: 'anSNSlXA',
|
||||
lastName: '3PhtPlBO',
|
||||
jobTitle: 'N/A',
|
||||
emailNotificationsEnabled: true,
|
||||
company: {},
|
||||
id: '0jl2FBTc',
|
||||
enabled: true,
|
||||
email: 'owAwLISy'
|
||||
}
|
||||
},
|
||||
{
|
||||
entry: {
|
||||
firstName: '84N1jji3',
|
||||
lastName: '748zEwJV',
|
||||
jobTitle: 'N/A',
|
||||
emailNotificationsEnabled: true,
|
||||
company: {},
|
||||
id: '0kd3jA3b',
|
||||
enabled: true,
|
||||
email: 'm1ooPRIu'
|
||||
}
|
||||
},
|
||||
{
|
||||
entry: {
|
||||
firstName: 'cPuvOYnb',
|
||||
lastName: 'GZK6IenG',
|
||||
jobTitle: 'N/A',
|
||||
emailNotificationsEnabled: true,
|
||||
company: {},
|
||||
id: '1BJSWj5u',
|
||||
enabled: true,
|
||||
email: 'UtKzKjje'
|
||||
}
|
||||
},
|
||||
{
|
||||
entry: {
|
||||
firstName: '87vRSHzf',
|
||||
lastName: 'OiLjkq9z',
|
||||
jobTitle: 'N/A',
|
||||
emailNotificationsEnabled: true,
|
||||
company: {},
|
||||
id: '1pvBqbmT',
|
||||
enabled: true,
|
||||
email: '72GemSCB'
|
||||
}
|
||||
},
|
||||
{
|
||||
entry: {
|
||||
firstName: 'QTxD4AWn',
|
||||
lastName: 'IHb5JiaR',
|
||||
jobTitle: 'N/A',
|
||||
emailNotificationsEnabled: true,
|
||||
company: {},
|
||||
id: '2fOamhbL',
|
||||
enabled: true,
|
||||
email: 'hhhQHpmZ'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@@ -0,0 +1,99 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import nock from 'nock';
|
||||
import { BaseMock } from '../base.mock';
|
||||
|
||||
export class RenditionMock extends BaseMock {
|
||||
get200RenditionResponse(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get('/alfresco/api/-default-/public/alfresco/versions/1/nodes/97a29e9c-1e4f-4d9d-bb02-1ec920dda045/renditions/pdf')
|
||||
.reply(200, {
|
||||
entry: {
|
||||
id: 'pdf',
|
||||
content: { mimeType: 'application/pdf', mimeTypeName: 'Adobe PDF Document' },
|
||||
status: 'NOT_CREATED'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
createRendition200(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.post('/alfresco/api/-default-/public/alfresco/versions/1/nodes/97a29e9c-1e4f-4d9d-bb02-1ec920dda045/renditions', { id: 'pdf' })
|
||||
.reply(202, '');
|
||||
}
|
||||
|
||||
get200RenditionList(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get('/alfresco/api/-default-/public/alfresco/versions/1/nodes/97a29e9c-1e4f-4d9d-bb02-1ec920dda045/renditions')
|
||||
.reply(200, {
|
||||
list: {
|
||||
pagination: {
|
||||
count: 6,
|
||||
hasMoreItems: false,
|
||||
totalItems: 6,
|
||||
skipCount: 0,
|
||||
maxItems: 100
|
||||
},
|
||||
entries: [
|
||||
{
|
||||
entry: {
|
||||
id: 'avatar',
|
||||
content: { mimeType: 'image/png', mimeTypeName: 'PNG Image' },
|
||||
status: 'NOT_CREATED'
|
||||
}
|
||||
},
|
||||
{
|
||||
entry: {
|
||||
id: 'avatar32',
|
||||
content: { mimeType: 'image/png', mimeTypeName: 'PNG Image' },
|
||||
status: 'NOT_CREATED'
|
||||
}
|
||||
},
|
||||
{
|
||||
entry: {
|
||||
id: 'doclib',
|
||||
content: { mimeType: 'image/png', mimeTypeName: 'PNG Image' },
|
||||
status: 'NOT_CREATED'
|
||||
}
|
||||
},
|
||||
{
|
||||
entry: {
|
||||
id: 'imgpreview',
|
||||
content: { mimeType: 'image/jpeg', mimeTypeName: 'JPEG Image' },
|
||||
status: 'NOT_CREATED'
|
||||
}
|
||||
},
|
||||
{
|
||||
entry: {
|
||||
id: 'medium',
|
||||
content: { mimeType: 'image/jpeg', mimeTypeName: 'JPEG Image' },
|
||||
status: 'NOT_CREATED'
|
||||
}
|
||||
},
|
||||
{
|
||||
entry: {
|
||||
id: 'pdf',
|
||||
content: { mimeType: 'application/pdf', mimeTypeName: 'Adobe PDF Document' },
|
||||
status: 'NOT_CREATED'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
53
lib/js-api/test/mockObjects/content-services/search.mock.ts
Normal file
53
lib/js-api/test/mockObjects/content-services/search.mock.ts
Normal file
@@ -0,0 +1,53 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import nock from 'nock';
|
||||
import { BaseMock } from '../base.mock';
|
||||
|
||||
export class SearchMock extends BaseMock {
|
||||
get200Response(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.post('/alfresco/api/-default-/public/search/versions/1/search', {
|
||||
query: {
|
||||
query: 'select * from cmis:folder',
|
||||
language: 'cmis'
|
||||
}
|
||||
})
|
||||
.reply(200, {
|
||||
list: {
|
||||
pagination: { count: 100, hasMoreItems: true, skipCount: 0, maxItems: 100 },
|
||||
entries: [
|
||||
{
|
||||
entry: {
|
||||
createdAt: '2017-04-10T10:52:30.868+0000',
|
||||
isFolder: true,
|
||||
search: { score: 1 },
|
||||
isFile: false,
|
||||
createdByUser: { id: 'admin', displayName: 'Administrator' },
|
||||
modifiedAt: '2017-04-10T10:52:30.868+0000',
|
||||
modifiedByUser: { id: 'admin', displayName: 'Administrator' },
|
||||
name: 'user',
|
||||
id: '224e30f4-a7b3-4192-b6e6-dc27d95e26ef',
|
||||
nodeType: 'cm:folder',
|
||||
parentId: '83551834-75d6-4e07-a318-46d5d176738a'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
99
lib/js-api/test/mockObjects/content-services/tag.mock.ts
Normal file
99
lib/js-api/test/mockObjects/content-services/tag.mock.ts
Normal file
@@ -0,0 +1,99 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import nock from 'nock';
|
||||
import { BaseMock } from '../base.mock';
|
||||
import { TagBody, TagEntry, TagPaging } from '../../../src/api/content-rest-api';
|
||||
|
||||
export class TagMock extends BaseMock {
|
||||
get200Response(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get('/alfresco/api/-default-/public/alfresco/versions/1/tags')
|
||||
.reply(200, this.getPaginatedListOfTags());
|
||||
}
|
||||
|
||||
getTagsByNameFilteredByMatching200Response(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get('/alfresco/api/-default-/public/alfresco/versions/1/tags?where=(tag%20matches%20(%27*tag-test*%27))')
|
||||
.reply(200, this.getPaginatedListOfTags());
|
||||
}
|
||||
|
||||
getTagsByNamesFilterByExactTag200Response(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get('/alfresco/api/-default-/public/alfresco/versions/1/tags?where=(tag%3D%27tag-test-1%27)')
|
||||
.reply(200, {
|
||||
list: {
|
||||
pagination: {
|
||||
count: 1,
|
||||
hasMoreItems: false,
|
||||
skipCount: 0,
|
||||
maxItems: 100
|
||||
},
|
||||
entries: [this.mockTagEntry()]
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get401Response(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get('/alfresco/api/-default-/public/alfresco/versions/1/tags')
|
||||
.reply(401, {
|
||||
error: {
|
||||
errorKey: 'framework.exception.ApiDefault',
|
||||
statusCode: 401,
|
||||
briefSummary: '05210059 Authentication failed for Web Script org/alfresco/api/ResourceWebScript.get',
|
||||
stackTrace: 'For security reasons the stack trace is no longer displayed, but the property is kept for previous versions.',
|
||||
descriptionURL: 'https://api-explorer.alfresco.com'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
createTags201Response(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.post('/alfresco/api/-default-/public/alfresco/versions/1/tags')
|
||||
.reply(201, [this.mockTagEntry(), this.mockTagEntry('tag-test-2', 'd79bdbd0-9f55-45bb-9521-811e15bf48f6')]);
|
||||
}
|
||||
|
||||
get201ResponseForAssigningTagsToNode(body: TagBody[]): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.post('/alfresco/api/-default-/public/alfresco/versions/1/nodes/someNodeId/tags', JSON.stringify(body))
|
||||
.reply(201, body.length > 1 ? this.getPaginatedListOfTags() : this.mockTagEntry());
|
||||
}
|
||||
|
||||
private getPaginatedListOfTags(): TagPaging {
|
||||
return {
|
||||
list: {
|
||||
pagination: {
|
||||
count: 2,
|
||||
hasMoreItems: false,
|
||||
skipCount: 0,
|
||||
maxItems: 100
|
||||
},
|
||||
entries: [this.mockTagEntry(), this.mockTagEntry('tag-test-2', 'd79bdbd0-9f55-45bb-9521-811e15bf48f6')]
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private mockTagEntry(tag = 'tag-test-1', id = '0d89aa82-f2b8-4a37-9a54-f4c5148174d6'): TagEntry {
|
||||
return {
|
||||
entry: {
|
||||
tag,
|
||||
id
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
104
lib/js-api/test/mockObjects/content-services/upload.mock.ts
Normal file
104
lib/js-api/test/mockObjects/content-services/upload.mock.ts
Normal file
@@ -0,0 +1,104 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import nock from 'nock';
|
||||
import { BaseMock } from '../base.mock';
|
||||
|
||||
export class UploadMock extends BaseMock {
|
||||
get201CreationFile(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.post('/alfresco/api/-default-/public/alfresco/versions/1/nodes/-root-/children')
|
||||
.reply(201, {
|
||||
entry: {
|
||||
isFile: true,
|
||||
createdByUser: { id: 'admin', displayName: 'Administrator' },
|
||||
modifiedAt: '2016-07-08T16:08:10.218+0000',
|
||||
nodeType: 'cm:content',
|
||||
content: {
|
||||
mimeType: 'text/plain',
|
||||
mimeTypeName: 'Plain Text',
|
||||
sizeInBytes: 28,
|
||||
encoding: 'ISO-8859-2'
|
||||
},
|
||||
parentId: '55290409-3c61-41e5-80f6-8354ed133ce0',
|
||||
aspectNames: ['cm:versionable', 'cm:titled', 'cm:auditable', 'cm:author'],
|
||||
createdAt: '2016-07-08T16:08:10.218+0000',
|
||||
isFolder: false,
|
||||
modifiedByUser: { id: 'admin', displayName: 'Administrator' },
|
||||
name: 'testFile.txt',
|
||||
id: '2857abfd-0ac6-459d-a22d-ec78770570f3',
|
||||
properties: { 'cm:versionLabel': '1.0', 'cm:versionType': 'MAJOR' }
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get201CreationFileAutoRename(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.post('/alfresco/api/-default-/public/alfresco/versions/1/nodes/-root-/children')
|
||||
.query({ autoRename: 'true' })
|
||||
.reply(201, {
|
||||
entry: {
|
||||
isFile: true,
|
||||
createdByUser: { id: 'admin', displayName: 'Administrator' },
|
||||
modifiedAt: '2016-07-08T17:04:34.684+0000',
|
||||
nodeType: 'cm:content',
|
||||
content: {
|
||||
mimeType: 'text/plain',
|
||||
mimeTypeName: 'Plain Text',
|
||||
sizeInBytes: 28,
|
||||
encoding: 'ISO-8859-2'
|
||||
},
|
||||
parentId: '55290409-3c61-41e5-80f6-8354ed133ce0',
|
||||
aspectNames: ['cm:versionable', 'cm:titled', 'cm:auditable', 'cm:author'],
|
||||
createdAt: '2016-07-08T17:04:34.684+0000',
|
||||
isFolder: false,
|
||||
modifiedByUser: { id: 'admin', displayName: 'Administrator' },
|
||||
name: 'testFile-2.txt',
|
||||
id: 'ae314293-27e8-4221-9a09-699f103db5f3',
|
||||
properties: { 'cm:versionLabel': '1.0', 'cm:versionType': 'MAJOR' }
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get409CreationFileNewNameClashes(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.post('/alfresco/api/-default-/public/alfresco/versions/1/nodes/-root-/children')
|
||||
.reply(409, {
|
||||
error: {
|
||||
errorKey: 'Duplicate child name not allowed: newFile',
|
||||
statusCode: 409,
|
||||
briefSummary: '06070090 Duplicate child name not allowed: newFile',
|
||||
stackTrace: 'For security reasons the stack trace is no longer displayed, but the property is kept for previous versions.',
|
||||
descriptionURL: 'https://api-explorer.alfresco.com'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get401Response(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.post('/alfresco/api/-default-/public/alfresco/versions/1/nodes/-root-/children')
|
||||
.reply(401, {
|
||||
error: {
|
||||
errorKey: 'framework.exception.ApiDefault',
|
||||
statusCode: 401,
|
||||
briefSummary: '05210059 Authentication failed for Web Script org/alfresco/api/ResourceWebScript.get',
|
||||
stackTrace: 'For security reasons the stack trace is no longer displayed, but the property is kept for previous versions.',
|
||||
descriptionURL: 'https://api-explorer.alfresco.com'
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
122
lib/js-api/test/mockObjects/content-services/version.mock.ts
Normal file
122
lib/js-api/test/mockObjects/content-services/version.mock.ts
Normal file
@@ -0,0 +1,122 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import nock from 'nock';
|
||||
import { BaseMock } from '../base.mock';
|
||||
|
||||
export class VersionMock extends BaseMock {
|
||||
post201Response(nodeId: string, versionId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.post('/alfresco/api/-default-/public/alfresco/versions/1/nodes/' + nodeId + '/versions/' + versionId + '/revert')
|
||||
.reply(201, { entry: { id: '3.0' } });
|
||||
}
|
||||
|
||||
get200Response(nodeId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get('/alfresco/api/-default-/public/alfresco/versions/1/nodes/' + nodeId + '/versions')
|
||||
.reply(200, {
|
||||
list: {
|
||||
pagination: {
|
||||
count: 2,
|
||||
hasMoreItems: false,
|
||||
totalItems: 2,
|
||||
skipCount: 0,
|
||||
maxItems: 100
|
||||
},
|
||||
entries: [{ entry: { id: '2.0' } }, { entry: { id: '1.0' } }]
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get200ResponseVersionRenditions(nodeId: string, versionId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get('/alfresco/api/-default-/public/alfresco/versions/1/nodes/' + nodeId + '/versions/' + versionId + '/renditions')
|
||||
.reply(200, {
|
||||
list: {
|
||||
pagination: {
|
||||
count: 6,
|
||||
hasMoreItems: false,
|
||||
totalItems: 6,
|
||||
skipCount: 0,
|
||||
maxItems: 100
|
||||
},
|
||||
entries: [
|
||||
{
|
||||
entry: {
|
||||
id: 'avatar',
|
||||
content: { mimeType: 'image/png', mimeTypeName: 'PNG Image' },
|
||||
status: 'NOT_CREATED'
|
||||
}
|
||||
},
|
||||
{
|
||||
entry: {
|
||||
id: 'avatar32',
|
||||
content: { mimeType: 'image/png', mimeTypeName: 'PNG Image' },
|
||||
status: 'NOT_CREATED'
|
||||
}
|
||||
},
|
||||
{
|
||||
entry: {
|
||||
id: 'doclib',
|
||||
content: { mimeType: 'image/png', mimeTypeName: 'PNG Image' },
|
||||
status: 'NOT_CREATED'
|
||||
}
|
||||
},
|
||||
{
|
||||
entry: {
|
||||
id: 'imgpreview',
|
||||
content: { mimeType: 'image/jpeg', mimeTypeName: 'JPEG Image' },
|
||||
status: 'NOT_CREATED'
|
||||
}
|
||||
},
|
||||
{
|
||||
entry: {
|
||||
id: 'medium',
|
||||
content: { mimeType: 'image/jpeg', mimeTypeName: 'JPEG Image' },
|
||||
status: 'NOT_CREATED'
|
||||
}
|
||||
},
|
||||
{
|
||||
entry: {
|
||||
id: 'pdf',
|
||||
content: { mimeType: 'application/pdf', mimeTypeName: 'Adobe PDF Document' },
|
||||
status: 'NOT_CREATED'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get200VersionRendition(nodeId: string, versionId: string, renditionId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get('/alfresco/api/-default-/public/alfresco/versions/1/nodes/' + nodeId + '/versions/' + versionId + '/renditions/' + renditionId)
|
||||
.reply(200, {
|
||||
entry: {
|
||||
id: 'pdf',
|
||||
content: { mimeType: 'application/pdf', mimeTypeName: 'Adobe PDF Document' },
|
||||
status: 'NOT_CREATED'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
create200VersionRendition(nodeId: string, versionId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.post('/alfresco/api/-default-/public/alfresco/versions/1/nodes/' + nodeId + '/versions/' + versionId + '/renditions', { id: 'pdf' })
|
||||
.reply(202, '');
|
||||
}
|
||||
}
|
@@ -0,0 +1,84 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import nock from 'nock';
|
||||
import { BaseMock } from '../base.mock';
|
||||
|
||||
export class WebScriptMock extends BaseMock {
|
||||
contextRoot: string;
|
||||
servicePath: string;
|
||||
scriptPath: string;
|
||||
scriptSlug: string;
|
||||
|
||||
constructor(host?: string, contextRoot?: string, servicePath?: string, scriptPath?: string) {
|
||||
super(host);
|
||||
this.contextRoot = contextRoot || 'alfresco';
|
||||
this.servicePath = servicePath || 'service';
|
||||
this.scriptPath = scriptPath;
|
||||
|
||||
this.scriptSlug = '/' + this.contextRoot + '/' + this.servicePath + '/' + this.scriptPath;
|
||||
}
|
||||
|
||||
get404Response(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get(this.scriptSlug)
|
||||
.reply(404, {
|
||||
error: {
|
||||
errorKey: 'Unable to locate resource resource for :alfresco ',
|
||||
statusCode: 404,
|
||||
briefSummary: '06130000 Unable to locate resource resource for :alfresco ',
|
||||
stackTrace: 'For security reasons the stack trace is no longer displayed, but the property is kept for previous versions.',
|
||||
descriptionURL: 'https://api-explorer.alfresco.com'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get200Response(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get(this.scriptSlug)
|
||||
.reply(200, {
|
||||
randomStructure: {
|
||||
exampleInt: 1,
|
||||
exampleString: 'string test'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get200ResponseHTMLFormat(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get('/alfresco/service/sample/folder/Company%20Home')
|
||||
.reply(
|
||||
200,
|
||||
// eslint-disable-next-line max-len
|
||||
'<html>\n <head>\n <title>/Company Home</title>\n </head>\n <body>\n Folder: /Company Home\n <br>\n <table>\n <tr>\n <td>><td><a href="/alfresco/service/sample/folder/Company%20Home/Data%20Dictionary">Data Dictionary</a>\n </tr>\n <tr>\n <td>><td><a href="/alfresco/service/sample/folder/Company%20Home/Guest%20Home">Guest Home</a>\n </tr>\n <tr>\n <td>><td><a href="/alfresco/service/sample/folder/Company%20Home/User%20Homes">User Homes</a>\n </tr>\n <tr>\n <td>><td><a href="/alfresco/service/sample/folder/Company%20Home/Shared">Shared</a>\n </tr>\n <tr>\n <td>><td><a href="/alfresco/service/sample/folder/Company%20Home/Imap%20Attachments">Imap Attachments</a>\n </tr>\n <tr>\n <td>><td><a href="/alfresco/service/sample/folder/Company%20Home/IMAP%20Home">IMAP Home</a>\n </tr>\n <tr>\n <td>><td><a href="/alfresco/service/sample/folder/Company%20Home/Sites">Sites</a>\n </tr>\n <tr>\n <td>><td><a href="/alfresco/service/sample/folder/Company%20Home/x">x</a>\n </tr>\n <tr>\n <td><td><a href="/alfresco/service/api/node/content/workspace/SpacesStore/2857abfd-0ac6-459d-a22d-ec78770570f3/testFile.txt">testFile.txt</a>\n </tr>\n <tr>\n <td>><td><a href="/alfresco/service/sample/folder/Company%20Home/newFolder">newFolder</a>\n </tr>\n <tr>\n <td>><td><a href="/alfresco/service/sample/folder/Company%20Home/newFolder-1">newFolder-1</a>\n </tr>\n <tr>\n <td><td><a href="/alfresco/service/api/node/content/workspace/SpacesStore/21ce66a9-6bc5-4c49-8ad3-43d3b824a9a3/testFile-1.txt">testFile-1.txt</a>\n </tr>\n <tr>\n <td><td><a href="/alfresco/service/api/node/content/workspace/SpacesStore/ae314293-27e8-4221-9a09-699f103db5f3/testFile-2.txt">testFile-2.txt</a>\n </tr>\n <tr>\n <td><td><a href="/alfresco/service/api/node/content/workspace/SpacesStore/935c1a72-647f-4c8f-aab6-e3b161978427/testFile-3.txt">testFile-3.txt</a>\n </tr>\n </table>\n </body>\n</html>\n\n'
|
||||
); // jshint ignore:line
|
||||
}
|
||||
|
||||
get401Response(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get(this.scriptSlug)
|
||||
.reply(401, {
|
||||
error: {
|
||||
errorKey: 'framework.exception.ApiDefault',
|
||||
statusCode: 401,
|
||||
briefSummary: '05210059 Authentication failed for Web Script org/alfresco/api/ResourceWebScript.get',
|
||||
stackTrace: 'For security reasons the stack trace is no longer displayed, but the property is kept for previous versions.',
|
||||
descriptionURL: 'https://api-explorer.alfresco.com'
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@@ -0,0 +1,139 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { BaseMock } from '../base.mock';
|
||||
import nock from 'nock';
|
||||
|
||||
export class AuthorityClearanceMock extends BaseMock {
|
||||
get200AuthorityClearanceForAuthority(authorityId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get('/alfresco/api/-default-/public/gs/versions/1/cleared-authorities/' + authorityId + '/clearing-marks?skipCount=0&maxItems=100')
|
||||
.reply(200, {
|
||||
list: {
|
||||
pagination: {
|
||||
count: 2,
|
||||
hasMoreItems: false,
|
||||
totalItems: 2,
|
||||
skipCount: 0,
|
||||
maxItems: 100
|
||||
},
|
||||
entries: [
|
||||
{
|
||||
entry: {
|
||||
id: 'securityGroupFruits',
|
||||
displayLabel: 'Security Group FRUITS',
|
||||
systemGroup: false,
|
||||
type: 'USER_REQUIRES_ALL',
|
||||
marks: [
|
||||
{
|
||||
id: 'fruitMarkId1',
|
||||
displayLabel: 'APPLES',
|
||||
applied: true,
|
||||
inherited: false
|
||||
},
|
||||
{
|
||||
id: 'fruitMarkId2',
|
||||
displayLabel: 'BANANAS',
|
||||
applied: false,
|
||||
inherited: false
|
||||
},
|
||||
{
|
||||
id: 'fruitMarkId3',
|
||||
displayLabel: 'MANGOES',
|
||||
applied: false,
|
||||
inherited: true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
entry: {
|
||||
id: 'securityGroupAnimals',
|
||||
displayLabel: 'Security Group ANIMALS',
|
||||
systemGroup: false,
|
||||
type: 'USER_REQUIRES_ANY',
|
||||
marks: [
|
||||
{
|
||||
id: 'animalMarkId1',
|
||||
displayLabel: 'LION',
|
||||
applied: true,
|
||||
inherited: false
|
||||
},
|
||||
{
|
||||
id: 'animalMarkId1',
|
||||
displayLabel: 'TIGER',
|
||||
applied: true,
|
||||
inherited: false
|
||||
},
|
||||
{
|
||||
id: 'animalMarkId1',
|
||||
displayLabel: 'ZEBRA',
|
||||
applied: true,
|
||||
inherited: false
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
post200AuthorityClearanceWithSingleItem(authorityId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.post('/alfresco/api/-default-/public/gs/versions/1/cleared-authorities/' + authorityId + '/clearing-marks')
|
||||
.reply(200, {
|
||||
entry: {
|
||||
id: 'fruitMarkId1',
|
||||
name: 'APPLES',
|
||||
groupId: 'securityGroupFruits'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
post200AuthorityClearanceWithList(authorityId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.post('/alfresco/api/-default-/public/gs/versions/1/cleared-authorities/' + authorityId + '/clearing-marks')
|
||||
.reply(200, {
|
||||
list: {
|
||||
pagination: {
|
||||
count: 2,
|
||||
hasMoreItems: false,
|
||||
totalItems: 2,
|
||||
skipCount: 0,
|
||||
maxItems: 100
|
||||
},
|
||||
entries: [
|
||||
{
|
||||
entry: {
|
||||
id: 'fruitMarkId1',
|
||||
name: 'APPLES',
|
||||
groupId: 'securityGroupFruits'
|
||||
}
|
||||
},
|
||||
{
|
||||
entry: {
|
||||
id: 'fruitMarkId2',
|
||||
name: 'BANANAS',
|
||||
groupId: 'securityGroupFruits'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@@ -0,0 +1,37 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import nock from 'nock';
|
||||
import { BaseMock } from '../base.mock';
|
||||
|
||||
export class GsSitesApiMock extends BaseMock {
|
||||
get200Response(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get('/alfresco/api/-default-/public/gs/versions/1/gs-sites/rm')
|
||||
.reply(200, {
|
||||
entry: {
|
||||
role: 'SiteManager',
|
||||
visibility: 'PUBLIC',
|
||||
compliance: 'STANDARD',
|
||||
guid: 'fd870d47-57a0-46f7-83c8-c523a4da13c4',
|
||||
description: 'Records Management Description Test',
|
||||
id: 'rm',
|
||||
title: 'Records Management'
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@@ -0,0 +1,85 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import nock from 'nock';
|
||||
import { BaseMock } from '../base.mock';
|
||||
|
||||
export class NodeSecurityMarksApiMock extends BaseMock {
|
||||
post200manageSecurityMarkOnNode(nodeId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.post('/alfresco/api/-default-/public/gs/versions/1/secured-nodes/' + nodeId + '/securing-marks')
|
||||
.reply(200, {
|
||||
list: {
|
||||
pagination: {
|
||||
count: 2,
|
||||
hasMoreItems: false,
|
||||
totalItems: 2,
|
||||
skipCount: 0,
|
||||
maxItems: 100
|
||||
},
|
||||
entries: [
|
||||
{
|
||||
entry: {
|
||||
groupId: 'securityGroupId1',
|
||||
name: 'SecurityMarkTest1',
|
||||
id: 'Sh1G8vTQ'
|
||||
}
|
||||
},
|
||||
{
|
||||
entry: {
|
||||
groupId: 'securityGroupId2',
|
||||
name: 'SecurityMarkTest2',
|
||||
id: 'Sh1G8vTR'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get200SecurityMarkOnNode(nodeId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get('/alfresco/api/-default-/public/gs/versions/1/secured-nodes/' + nodeId + '/securing-marks')
|
||||
.reply(200, {
|
||||
list: {
|
||||
pagination: {
|
||||
count: 2,
|
||||
hasMoreItems: false,
|
||||
totalItems: 2,
|
||||
skipCount: 0,
|
||||
maxItems: 100
|
||||
},
|
||||
entries: [
|
||||
{
|
||||
entry: {
|
||||
groupId: 'securityGroupId1',
|
||||
name: 'SecurityMarkTest1',
|
||||
id: 'Sh1G8vTQ'
|
||||
}
|
||||
},
|
||||
{
|
||||
entry: {
|
||||
groupId: 'securityGroupId2',
|
||||
name: 'SecurityMarkTest2',
|
||||
id: 'Sh1G8vTR'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@@ -0,0 +1,95 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import nock from 'nock';
|
||||
import { BaseMock } from '../base.mock';
|
||||
|
||||
export class SecurityGroupApiMock extends BaseMock {
|
||||
createSecurityGroup200Response(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.post('/alfresco/api/-default-/public/gs/versions/1/security-groups')
|
||||
.reply(200, {
|
||||
entry: {
|
||||
groupName: 'Alfresco',
|
||||
groupType: 'HIERARCHICAL',
|
||||
id: 'a0a7b107-84ba-4c3d-b0b7-a8509e8c1c33'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
getSecurityGroups200Response(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get('/alfresco/api/-default-/public/gs/versions/1/security-groups')
|
||||
.reply(200, {
|
||||
list: {
|
||||
pagination: {
|
||||
count: 2,
|
||||
hasMoreItems: false,
|
||||
totalItems: 2,
|
||||
skipCount: 0,
|
||||
maxItems: 100
|
||||
},
|
||||
entries: [
|
||||
{
|
||||
entry: {
|
||||
groupName: 'Alfresco',
|
||||
groupType: 'HIERARCHICAL',
|
||||
id: 'a0a7b107-84ba-4c3d-b0b7-a8509e8c1c33'
|
||||
}
|
||||
},
|
||||
{
|
||||
entry: {
|
||||
groupName: 'Classification',
|
||||
groupType: 'HIERARCHICAL',
|
||||
id: 'classification'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
getSecurityGroupInfo200Response(securityGroupId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get('/alfresco/api/-default-/public/gs/versions/1/security-groups/' + securityGroupId)
|
||||
.reply(200, {
|
||||
entry: {
|
||||
groupName: 'Alfresco',
|
||||
groupType: 'HIERARCHICAL',
|
||||
id: 'a0a7b107-84ba-4c3d-b0b7-a8509e8c1c33'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
updateSecurityGroup200Response(securityGroupId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.put('/alfresco/api/-default-/public/gs/versions/1/security-groups/' + securityGroupId)
|
||||
.reply(200, {
|
||||
entry: {
|
||||
groupName: 'Nasa',
|
||||
groupType: 'HIERARCHICAL',
|
||||
id: 'a0a7b107-84ba-4c3d-b0b7-a8509e8c1c33'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
deleteSecurityGroup200Response(securityGroupId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.delete('/alfresco/api/-default-/public/alfresco/versions/1/security-groups/' + securityGroupId)
|
||||
.reply(200);
|
||||
}
|
||||
}
|
@@ -0,0 +1,129 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import nock from 'nock';
|
||||
import { BaseMock } from '../base.mock';
|
||||
|
||||
export class SecurityMarkApiMock extends BaseMock {
|
||||
get200GetSecurityMark(securityGroupId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get('/alfresco/api/-default-/public/gs/versions/1/security-groups/' + securityGroupId + '/security-marks')
|
||||
.reply(200, {
|
||||
list: {
|
||||
pagination: {
|
||||
count: 1,
|
||||
hasMoreItems: false,
|
||||
totalItems: 1,
|
||||
skipCount: 0,
|
||||
maxItems: 100
|
||||
},
|
||||
entries: [
|
||||
{
|
||||
entry: {
|
||||
groupId: securityGroupId,
|
||||
name: 'SecurityMarkTest',
|
||||
id: 'Sh1G8vTQ'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
createSecurityMark200Response(securityGroupId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.post('/alfresco/api/-default-/public/gs/versions/1/security-groups/' + securityGroupId + '/security-marks')
|
||||
.reply(200, {
|
||||
entry: {
|
||||
groupId: securityGroupId,
|
||||
name: 'SecurityMarkTest',
|
||||
id: 'Sh1G8vTQ'
|
||||
}
|
||||
});
|
||||
}
|
||||
createSecurityMarks200Response(securityGroupId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.post('/alfresco/api/-default-/public/gs/versions/1/security-groups/' + securityGroupId + '/security-marks')
|
||||
.reply(200, {
|
||||
list: {
|
||||
pagination: {
|
||||
count: 2,
|
||||
hasMoreItems: false,
|
||||
totalItems: 2,
|
||||
skipCount: 0,
|
||||
maxItems: 100
|
||||
},
|
||||
entries: [
|
||||
{
|
||||
entry: {
|
||||
groupId: securityGroupId,
|
||||
name: 'SecurityMark3',
|
||||
id: 'KsnOlXVM'
|
||||
}
|
||||
},
|
||||
{
|
||||
entry: {
|
||||
groupId: securityGroupId,
|
||||
name: 'SecurityMark4',
|
||||
id: 'wFYkG8CV'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
}
|
||||
get200GetSingleSecurityMark(securityGroupId: string, securityMarkId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get('/alfresco/api/-default-/public/gs/versions/1/security-groups/' + securityGroupId + '/security-marks/' + securityMarkId)
|
||||
.reply(200, {
|
||||
entry: {
|
||||
groupId: securityGroupId,
|
||||
name: 'SecurityMarkTest',
|
||||
id: securityMarkId
|
||||
}
|
||||
});
|
||||
}
|
||||
put200UpdateSecurityMarkResponse(securityGroupId: string, securityMarkId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.put('/alfresco/api/-default-/public/gs/versions/1/security-groups/' + securityGroupId + '/security-marks/' + securityMarkId)
|
||||
.reply(200, {
|
||||
entry: {
|
||||
groupId: securityGroupId,
|
||||
name: 'AlfrescoSecurityMark',
|
||||
id: securityMarkId
|
||||
}
|
||||
});
|
||||
}
|
||||
getDeleteSecurityMarkSuccessfulResponse(securityGroupId: string, securityMarkId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.delete('/alfresco/api/-default-/public/gs/versions/1/security-groups/' + securityGroupId + '/security-marks/' + securityMarkId)
|
||||
.reply(200);
|
||||
}
|
||||
get401Response(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get('/alfresco/api/-default-/public/gs/versions/1/security-groups/')
|
||||
.reply(401, {
|
||||
error: {
|
||||
errorKey: 'framework.exception.ApiDefault',
|
||||
statusCode: 401,
|
||||
briefSummary: '05210059 Authentication failed for Web Script org/alfresco/api/ResourceWebScript.get',
|
||||
stackTrace: 'For security reasons the stack trace is no longer displayed, but the property is kept for previous versions.',
|
||||
descriptionURL: 'https://api-explorer.alfresco.com'
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
51
lib/js-api/test/mockObjects/index.ts
Normal file
51
lib/js-api/test/mockObjects/index.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export * from './content-services/categories.mock';
|
||||
export * from './content-services/comment.mock';
|
||||
export * from './content-services/ecm-auth.mock';
|
||||
export * from './content-services/custom-model.mock';
|
||||
export * from './content-services/discovery.mock';
|
||||
export * from './content-services/node.mock';
|
||||
export * from './content-services/people.mock';
|
||||
export * from './content-services/groups.mock';
|
||||
export * from './content-services/find-nodes.mock';
|
||||
export * from './content-services/rendition.mock';
|
||||
export * from './content-services/search.mock';
|
||||
export * from './content-services/tag.mock';
|
||||
export * from './content-services/upload.mock';
|
||||
export * from './content-services/version.mock';
|
||||
export * from './content-services/webscript.mock';
|
||||
|
||||
export * from './goverance-services/authority-clearance.mock';
|
||||
export * from './goverance-services/gs-sites.mock';
|
||||
export * from './goverance-services/node-security-marks.mock';
|
||||
export * from './goverance-services/security-groups.mock';
|
||||
export * from './goverance-services/security-marks.mock';
|
||||
|
||||
export * from './process-services/bpm-auth.mock';
|
||||
export * from './process-services/process.mock';
|
||||
export * from './process-services/process-instance-variables.mock';
|
||||
export * from './process-services/models.mock';
|
||||
export * from './process-services/model-json.mock';
|
||||
export * from './process-services/profile.mock';
|
||||
export * from './process-services/reports.mock';
|
||||
export * from './process-services/task-form.mock';
|
||||
export * from './process-services/tasks.mock';
|
||||
export * from './process-services/user-filters.mock';
|
||||
|
||||
export * from './oauth2/oauth.mock';
|
46
lib/js-api/test/mockObjects/oauth2/oauth.mock.ts
Normal file
46
lib/js-api/test/mockObjects/oauth2/oauth.mock.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import nock from 'nock';
|
||||
import { BaseMock } from '../base.mock';
|
||||
|
||||
export class OAuthMock extends BaseMock {
|
||||
username: string;
|
||||
password: string;
|
||||
|
||||
constructor(host?: string, username?: string, password?: string) {
|
||||
super(host);
|
||||
this.username = username || 'admin';
|
||||
this.password = password || 'admin';
|
||||
}
|
||||
|
||||
get200Response(mockToken?: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.post('/auth/realms/springboot/protocol/openid-connect/token')
|
||||
.reply(200, {
|
||||
access_token: mockToken || 'test-token',
|
||||
expires_in: 300,
|
||||
refresh_expires_in: 1800,
|
||||
refresh_token:
|
||||
// eslint-disable-next-line max-len
|
||||
'eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICI0cHczOUltNE54dXZEN0ZqZ3JOQ3Q2ZkpaVDctQ3JWTzRkX3BLaXJlSTF3In0.eyJqdGkiOiI2MzQxMDc1ZC1lOTY4LTRmZTctOTkwZS05MTQ3NTUwOGEzZWIiLCJleHAiOjE1Mjk2MDkxMDYsIm5iZiI6MCwiaWF0IjoxNTI5NjA3MzA2LCJpc3MiOiJodHRwOi8vYTVlMmY5M2RlMTBhZjExZThhMDU2MGExYmVhNWI3YzgtMjM2NzA5NDMzLnVzLWVhc3QtMS5lbGIuYW1hem9uYXdzLmNvbTozMDA4MS9hdXRoL3JlYWxtcy9zcHJpbmdib290IiwiYXVkIjoiYWN0aXZpdGkiLCJzdWIiOiJlMjRjZjM0Mi1mYzUwLTRjYjEtYTBjMC01N2RhZWRiODI3NDkiLCJ0eXAiOiJSZWZyZXNoIiwiYXpwIjoiYWN0aXZpdGkiLCJhdXRoX3RpbWUiOjAsInNlc3Npb25fc3RhdGUiOiI5NDMzZTIwNi1kZjFhLTQ2YTMtYmU3ZS02NWIwNDVhMWMzNmIiLCJyZWFsbV9hY2Nlc3MiOnsicm9sZXMiOlsiYWRtaW4iLCJ1bWFfYXV0aG9yaXphdGlvbiJdfSwicmVzb3VyY2VfYWNjZXNzIjp7InJlYWxtLW1hbmFnZW1lbnQiOnsicm9sZXMiOlsidmlldy1pZGVudGl0eS1wcm92aWRlcnMiLCJ2aWV3LXJlYWxtIiwibWFuYWdlLWlkZW50aXR5LXByb3ZpZGVycyIsImltcGVyc29uYXRpb24iLCJyZWFsbS1hZG1pbiIsImNyZWF0ZS1jbGllbnQiLCJtYW5hZ2UtdXNlcnMiLCJxdWVyeS1yZWFsbXMiLCJ2aWV3LWF1dGhvcml6YXRpb24iLCJxdWVyeS1jbGllbnRzIiwicXVlcnktdXNlcnMiLCJtYW5hZ2UtZXZlbnRzIiwibWFuYWdlLXJlYWxtIiwidmlldy1ldmVudHMiLCJ2aWV3LXVzZXJzIiwidmlldy1jbGllbnRzIiwibWFuYWdlLWF1dGhvcml6YXRpb24iLCJtYW5hZ2UtY2xpZW50cyIsInF1ZXJ5LWdyb3VwcyJdfSwiYnJva2VyIjp7InJvbGVzIjpbInJlYWQtdG9rZW4iXX0sImFjY291bnQiOnsicm9sZXMiOlsibWFuYWdlLWFjY291bnQiLCJtYW5hZ2UtYWNjb3VudC1saW5rcyIsInZpZXctcHJvZmlsZSJdfX19.mQ4Vi1yLG9KvcmmhHlgOowy8D30iaUsiO7--JTPY7Ol-R1eY4wvRn1cH5FllieXk8yltYGP23xXNtTC4M54guXGVtgRgo8AlRklFHL1BMlxpa0OPwcNmwthx1-P2n7c9XL1e8pt2uRhQJLxunr2TpLaQi0UpEmEyouXHfR7sxM1AzKAf3b9Nk7f7lrk__2BYlFsL3YcGlFDqDMgPfhNlDbR-rQGoxlOjt0YqS8ktYq4bneL5etpXnPh0oEt4B7FFK-WKKuOWR6rQ9791ACnn6puz6C_Ki261IkZ0a_Uu7tOA4Xi9xzoQKLgSTAlBeg4u86Wb5kjL5r2-3zTg-Dikew',
|
||||
token_type: 'bearer',
|
||||
'not-before-policy': 0,
|
||||
session_state: '9433e206-df1a-46a3-be7e-65b045a1c36b'
|
||||
});
|
||||
}
|
||||
}
|
@@ -0,0 +1,68 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import nock from 'nock';
|
||||
import { BaseMock } from '../base.mock';
|
||||
|
||||
export class BpmAuthMock extends BaseMock {
|
||||
username: string;
|
||||
password: string;
|
||||
|
||||
constructor(host?: string, username?: string, password?: string) {
|
||||
super(host);
|
||||
this.username = username || 'admin';
|
||||
this.password = password || 'admin';
|
||||
}
|
||||
|
||||
get200Response(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.post(
|
||||
'/activiti-app/app/authentication',
|
||||
'j_username=' + this.username + '&j_password=' + this.password + '&_spring_security_remember_me=true&submit=Login'
|
||||
)
|
||||
.reply(200);
|
||||
}
|
||||
|
||||
get200ResponseLogout(): void {
|
||||
nock(this.host, { encodedQueryParams: true }).get('/activiti-app/app/logout', {}).reply(200);
|
||||
}
|
||||
|
||||
get401Response(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.post('/activiti-app/app/authentication', 'j_username=wrong&j_password=name&_spring_security_remember_me=true&submit=Login')
|
||||
.reply(401, {
|
||||
error: {
|
||||
message: 'This request requires HTTP authentication.',
|
||||
statusCode: 401
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get403Response(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.post('/activiti-app/app/authentication', 'j_username=wrong&j_password=name&_spring_security_remember_me=true&submit=Login')
|
||||
.reply(403, {
|
||||
error: {
|
||||
errorKey: 'Login failed',
|
||||
statusCode: 403,
|
||||
briefSummary: '05150009 Login failed',
|
||||
stackTrace: 'For security reasons the stack trace is no longer displayed, but the property is kept for previous versions.',
|
||||
descriptionURL: 'https://api-explorer.alfresco.com'
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
155
lib/js-api/test/mockObjects/process-services/model-json.mock.ts
Normal file
155
lib/js-api/test/mockObjects/process-services/model-json.mock.ts
Normal file
@@ -0,0 +1,155 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import nock from 'nock';
|
||||
import { BaseMock } from '../base.mock';
|
||||
|
||||
export class ModelJsonBpmMock extends BaseMock {
|
||||
get200EditorDisplayJsonClient(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get('/activiti-app/app/rest/models/1/model-json')
|
||||
.reply(200, {
|
||||
elements: [
|
||||
{
|
||||
id: 'startEvent1',
|
||||
name: null,
|
||||
x: 100,
|
||||
y: 163,
|
||||
width: 30,
|
||||
height: 30,
|
||||
type: 'StartEvent',
|
||||
properties: []
|
||||
},
|
||||
{
|
||||
id: 'sid-8B04E151-6B46-4F48-B49E-F719057353AD',
|
||||
name: null,
|
||||
x: 175,
|
||||
y: 138,
|
||||
width: 100,
|
||||
height: 80,
|
||||
type: 'UserTask',
|
||||
properties: [{ name: 'Assignee', value: '$INITIATOR' }]
|
||||
},
|
||||
{
|
||||
id: 'sid-8F6A225D-91AC-4FE3-8DDF-7DF034A37C44',
|
||||
name: null,
|
||||
x: 320,
|
||||
y: 164,
|
||||
width: 28,
|
||||
height: 28,
|
||||
type: 'EndEvent',
|
||||
properties: []
|
||||
}
|
||||
],
|
||||
flows: [
|
||||
{
|
||||
id: 'sid-BC321EAF-BF83-4343-91C4-C0E7C4E10133',
|
||||
type: 'sequenceFlow',
|
||||
sourceRef: 'startEvent1',
|
||||
targetRef: 'sid-8B04E151-6B46-4F48-B49E-F719057353AD',
|
||||
waypoints: [
|
||||
{ x: 130, y: 178 },
|
||||
{ x: 175, y: 178 }
|
||||
],
|
||||
properties: []
|
||||
},
|
||||
{
|
||||
id: 'sid-CA38A1B7-1BFC-44C1-B20D-86748AE7AAA0',
|
||||
type: 'sequenceFlow',
|
||||
sourceRef: 'sid-8B04E151-6B46-4F48-B49E-F719057353AD',
|
||||
targetRef: 'sid-8F6A225D-91AC-4FE3-8DDF-7DF034A37C44',
|
||||
waypoints: [
|
||||
{ x: 275, y: 178 },
|
||||
{ x: 320, y: 178 }
|
||||
],
|
||||
properties: []
|
||||
}
|
||||
],
|
||||
diagramBeginX: 115,
|
||||
diagramBeginY: 138,
|
||||
diagramWidth: 348,
|
||||
diagramHeight: 218
|
||||
});
|
||||
}
|
||||
|
||||
get200HistoricEditorDisplayJsonClient(): void {
|
||||
nock('https://127.0.0.1:9999', { encodedQueryParams: true })
|
||||
.get('/activiti-app/app/rest/models/1/history/1/model-json')
|
||||
.reply(200, {
|
||||
elements: [
|
||||
{
|
||||
id: 'startEvent1',
|
||||
name: null,
|
||||
x: 100,
|
||||
y: 163,
|
||||
width: 30,
|
||||
height: 30,
|
||||
type: 'StartEvent',
|
||||
properties: []
|
||||
},
|
||||
{
|
||||
id: 'sid-8B04E151-6B46-4F48-B49E-F719057353AD',
|
||||
name: null,
|
||||
x: 175,
|
||||
y: 138,
|
||||
width: 100,
|
||||
height: 80,
|
||||
type: 'UserTask',
|
||||
properties: [{ name: 'Assignee', value: '$INITIATOR' }]
|
||||
},
|
||||
{
|
||||
id: 'sid-8F6A225D-91AC-4FE3-8DDF-7DF034A37C44',
|
||||
name: null,
|
||||
x: 320,
|
||||
y: 164,
|
||||
width: 28,
|
||||
height: 28,
|
||||
type: 'EndEvent',
|
||||
properties: []
|
||||
}
|
||||
],
|
||||
flows: [
|
||||
{
|
||||
id: 'sid-BC321EAF-BF83-4343-91C4-C0E7C4E10133',
|
||||
type: 'sequenceFlow',
|
||||
sourceRef: 'startEvent1',
|
||||
targetRef: 'sid-8B04E151-6B46-4F48-B49E-F719057353AD',
|
||||
waypoints: [
|
||||
{ x: 130, y: 178 },
|
||||
{ x: 175, y: 178 }
|
||||
],
|
||||
properties: []
|
||||
},
|
||||
{
|
||||
id: 'sid-CA38A1B7-1BFC-44C1-B20D-86748AE7AAA0',
|
||||
type: 'sequenceFlow',
|
||||
sourceRef: 'sid-8B04E151-6B46-4F48-B49E-F719057353AD',
|
||||
targetRef: 'sid-8F6A225D-91AC-4FE3-8DDF-7DF034A37C44',
|
||||
waypoints: [
|
||||
{ x: 275, y: 178 },
|
||||
{ x: 320, y: 178 }
|
||||
],
|
||||
properties: []
|
||||
}
|
||||
],
|
||||
diagramBeginX: 115,
|
||||
diagramBeginY: 138,
|
||||
diagramWidth: 348,
|
||||
diagramHeight: 218
|
||||
});
|
||||
}
|
||||
}
|
53
lib/js-api/test/mockObjects/process-services/models.mock.ts
Normal file
53
lib/js-api/test/mockObjects/process-services/models.mock.ts
Normal file
@@ -0,0 +1,53 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import nock from 'nock';
|
||||
import { BaseMock } from '../base.mock';
|
||||
|
||||
export class ModelsMock extends BaseMock {
|
||||
get200getModels(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get('/activiti-app/api/enterprise/models')
|
||||
.query({ filter: 'myReusableForms', modelType: '2' })
|
||||
.reply(200, {
|
||||
size: 1,
|
||||
total: 1,
|
||||
start: 0,
|
||||
data: [
|
||||
{
|
||||
id: 1,
|
||||
name: 'Metadata',
|
||||
description: '',
|
||||
createdBy: 1,
|
||||
createdByFullName: ' Administrator',
|
||||
lastUpdatedBy: 1,
|
||||
lastUpdatedByFullName: ' Administrator',
|
||||
lastUpdated: '2016-08-05T17:39:22.750+0000',
|
||||
latestVersion: true,
|
||||
version: 2,
|
||||
comment: null,
|
||||
stencilSet: null,
|
||||
referenceId: null,
|
||||
modelType: 2,
|
||||
favorite: null,
|
||||
permission: 'write',
|
||||
tenantId: 1
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
}
|
@@ -0,0 +1,110 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import nock from 'nock';
|
||||
import { BaseMock } from '../base.mock';
|
||||
|
||||
const fakeVariable1 = {
|
||||
name: 'variable1',
|
||||
value: 'Value 123',
|
||||
scope: 'global'
|
||||
};
|
||||
|
||||
const fakeVariable2 = {
|
||||
name: 'variable2',
|
||||
value: 'Value 456',
|
||||
scope: 'local'
|
||||
};
|
||||
|
||||
const fakeVariablesList = [fakeVariable1, fakeVariable2];
|
||||
|
||||
export class ProcessInstanceVariablesMock extends BaseMock {
|
||||
addListProcessInstanceVariables200Response(processInstanceId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get('/activiti-app/api/enterprise/process-instances/' + processInstanceId + '/variables')
|
||||
.reply(200, fakeVariablesList);
|
||||
}
|
||||
|
||||
addListProcessInstanceVariables500Response(processInstanceId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get('/activiti-app/api/enterprise/process-instances/' + processInstanceId + '/variables')
|
||||
.reply(500, {
|
||||
messageKey: 'UNKNOWN',
|
||||
message: 'Unknown error'
|
||||
});
|
||||
}
|
||||
|
||||
addPutProcessInstanceVariables200Response(processInstanceId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.put('/activiti-app/api/enterprise/process-instances/' + processInstanceId + '/variables')
|
||||
.reply(200, fakeVariablesList);
|
||||
}
|
||||
|
||||
addPutProcessInstanceVariables500Response(processInstanceId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.put('/activiti-app/api/enterprise/process-instances/' + processInstanceId + '/variables')
|
||||
.reply(500, {
|
||||
messageKey: 'UNKNOWN',
|
||||
message: 'Unknown error'
|
||||
});
|
||||
}
|
||||
|
||||
addGetProcessInstanceVariable200Response(processInstanceId: string, variableName: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get('/activiti-app/api/enterprise/process-instances/' + processInstanceId + '/variables/' + variableName)
|
||||
.reply(200, fakeVariable1);
|
||||
}
|
||||
|
||||
addGetProcessInstanceVariable500Response(processInstanceId: string, variableName: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get('/activiti-app/api/enterprise/process-instances/' + processInstanceId + '/variables/' + variableName)
|
||||
.reply(500, {
|
||||
messageKey: 'UNKNOWN',
|
||||
message: 'Unknown error'
|
||||
});
|
||||
}
|
||||
|
||||
addUpdateProcessInstanceVariable200Response(processInstanceId: string, variableName: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.put('/activiti-app/api/enterprise/process-instances/' + processInstanceId + '/variables/' + variableName)
|
||||
.reply(200, fakeVariable1);
|
||||
}
|
||||
|
||||
addUpdateProcessInstanceVariable500Response(processInstanceId: string, variableName: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.put('/activiti-app/api/enterprise/process-instances/' + processInstanceId + '/variables/' + variableName)
|
||||
.reply(500, {
|
||||
messageKey: 'UNKNOWN',
|
||||
message: 'Unknown error'
|
||||
});
|
||||
}
|
||||
|
||||
addDeleteProcessInstanceVariable200Response(processInstanceId: string, variableName: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.delete('/activiti-app/api/enterprise/process-instances/' + processInstanceId + '/variables/' + variableName)
|
||||
.reply(200);
|
||||
}
|
||||
|
||||
addDeleteProcessInstanceVariable500Response(processInstanceId: string, variableName: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.delete('/activiti-app/api/enterprise/process-instances/' + processInstanceId + '/variables/' + variableName)
|
||||
.reply(500, {
|
||||
messageKey: 'UNKNOWN',
|
||||
message: 'Unknown error'
|
||||
});
|
||||
}
|
||||
}
|
160
lib/js-api/test/mockObjects/process-services/process.mock.ts
Normal file
160
lib/js-api/test/mockObjects/process-services/process.mock.ts
Normal file
@@ -0,0 +1,160 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import nock from 'nock';
|
||||
import { BaseMock } from '../base.mock';
|
||||
|
||||
export class ProcessMock extends BaseMock {
|
||||
get200Response(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.post('/activiti-app/api/enterprise/process-instances/query')
|
||||
.reply(200, {
|
||||
size: 2,
|
||||
total: 2,
|
||||
start: 0,
|
||||
data: [
|
||||
{
|
||||
id: '39',
|
||||
name: 'Process Test Api - July 26th 2016',
|
||||
businessKey: null,
|
||||
processDefinitionId: 'ProcessTestApi:1:32',
|
||||
tenantId: 'tenant_1',
|
||||
started: '2016-07-26T15:31:00.414+0000',
|
||||
ended: null,
|
||||
startedBy: {
|
||||
id: 1,
|
||||
firstName: null,
|
||||
lastName: 'Administrator',
|
||||
email: 'admin@app.activiti.com'
|
||||
},
|
||||
processDefinitionName: 'Process Test Api',
|
||||
processDefinitionDescription: null,
|
||||
processDefinitionKey: 'ProcessTestApi',
|
||||
processDefinitionCategory: 'https://www.activiti.org/processdef',
|
||||
processDefinitionVersion: 1,
|
||||
processDefinitionDeploymentId: '29',
|
||||
graphicalNotationDefined: true,
|
||||
startFormDefined: false,
|
||||
suspended: false,
|
||||
variables: []
|
||||
},
|
||||
{
|
||||
id: '33',
|
||||
name: 'Process Test Api - July 26th 2016',
|
||||
businessKey: null,
|
||||
processDefinitionId: 'ProcessTestApi:1:32',
|
||||
tenantId: 'tenant_1',
|
||||
started: '2016-07-26T15:30:58.367+0000',
|
||||
ended: null,
|
||||
startedBy: {
|
||||
id: 1,
|
||||
firstName: null,
|
||||
lastName: 'Administrator',
|
||||
email: 'admin@app.activiti.com'
|
||||
},
|
||||
processDefinitionName: 'Process Test Api',
|
||||
processDefinitionDescription: null,
|
||||
processDefinitionKey: 'ProcessTestApi',
|
||||
processDefinitionCategory: 'https://www.activiti.org/processdef',
|
||||
processDefinitionVersion: 1,
|
||||
processDefinitionDeploymentId: '29',
|
||||
graphicalNotationDefined: true,
|
||||
startFormDefined: false,
|
||||
suspended: false,
|
||||
variables: []
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
get200getProcessDefinitionStartForm(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get('/activiti-app/api/enterprise/process-definitions/testProcess%3A1%3A7504/start-form')
|
||||
.reply(200, {
|
||||
id: 2002,
|
||||
processDefinitionId: 'testProcess:1:7504',
|
||||
processDefinitionName: 'test process',
|
||||
processDefinitionKey: 'testProcess',
|
||||
tabs: [],
|
||||
fields: [
|
||||
{
|
||||
fieldType: 'DynamicTableRepresentation',
|
||||
id: 'label',
|
||||
name: 'Label',
|
||||
type: 'dynamic-table',
|
||||
value: null,
|
||||
required: false,
|
||||
readOnly: false,
|
||||
overrideId: false,
|
||||
colspan: 1,
|
||||
placeholder: null,
|
||||
minLength: 0,
|
||||
maxLength: 0,
|
||||
minValue: null,
|
||||
maxValue: null,
|
||||
regexPattern: null,
|
||||
optionType: null,
|
||||
hasEmptyValue: null,
|
||||
options: null,
|
||||
restUrl: null,
|
||||
restResponsePath: null,
|
||||
restIdProperty: null,
|
||||
restLabelProperty: null,
|
||||
tab: null,
|
||||
className: null,
|
||||
params: { existingColspan: 1, maxColspan: 1 },
|
||||
layout: { row: -1, column: -1, colspan: 2 },
|
||||
sizeX: 2,
|
||||
sizeY: 2,
|
||||
row: -1,
|
||||
col: -1,
|
||||
visibilityCondition: null,
|
||||
columnDefinitions: [
|
||||
{
|
||||
id: 'user',
|
||||
name: 'User',
|
||||
type: 'Dropdown',
|
||||
value: null,
|
||||
optionType: 'rest',
|
||||
options: [{ id: null, name: 'Option 1' }],
|
||||
restResponsePath: null,
|
||||
restUrl: 'https://jsonplaceholder.typicode.com/users',
|
||||
restIdProperty: 'id',
|
||||
restLabelProperty: 'name',
|
||||
amountCurrency: null,
|
||||
amountEnableFractions: false,
|
||||
required: true,
|
||||
editable: true,
|
||||
sortable: true,
|
||||
visible: true,
|
||||
endpoint: null,
|
||||
requestHeaders: null
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
outcomes: [],
|
||||
javascriptEvents: [],
|
||||
className: '',
|
||||
style: '',
|
||||
customFieldTemplates: {},
|
||||
metadata: {},
|
||||
variables: [],
|
||||
gridsterForm: false
|
||||
});
|
||||
}
|
||||
}
|
103
lib/js-api/test/mockObjects/process-services/profile.mock.ts
Normal file
103
lib/js-api/test/mockObjects/process-services/profile.mock.ts
Normal file
@@ -0,0 +1,103 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import nock from 'nock';
|
||||
import { BaseMock } from '../base.mock';
|
||||
|
||||
export class ProfileMock extends BaseMock {
|
||||
get200getProfile(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get('/activiti-app/api/enterprise/profile')
|
||||
.reply(200, {
|
||||
id: 1,
|
||||
firstName: null,
|
||||
lastName: 'Administrator',
|
||||
email: 'admin',
|
||||
externalId: null,
|
||||
company: null,
|
||||
pictureId: null,
|
||||
fullname: ' Administrator',
|
||||
password: null,
|
||||
type: 'enterprise',
|
||||
status: 'active',
|
||||
created: '2016-10-21T13:32:54.886+0000',
|
||||
lastUpdate: '2016-10-23T22:16:48.252+0000',
|
||||
tenantId: 1,
|
||||
latestSyncTimeStamp: null,
|
||||
groups: [
|
||||
{
|
||||
id: 1,
|
||||
name: 'analytics-users',
|
||||
externalId: null,
|
||||
status: 'active',
|
||||
tenantId: 1,
|
||||
type: 0,
|
||||
parentGroupId: null,
|
||||
lastSyncTimeStamp: null,
|
||||
userCount: null,
|
||||
users: null,
|
||||
capabilities: null,
|
||||
groups: null,
|
||||
manager: null
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: 'kickstart-users',
|
||||
externalId: null,
|
||||
status: 'active',
|
||||
tenantId: 1,
|
||||
type: 0,
|
||||
parentGroupId: null,
|
||||
lastSyncTimeStamp: null,
|
||||
userCount: null,
|
||||
users: null,
|
||||
capabilities: null,
|
||||
groups: null,
|
||||
manager: null
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: 'Superusers',
|
||||
externalId: null,
|
||||
status: 'active',
|
||||
tenantId: 1,
|
||||
type: 0,
|
||||
parentGroupId: null,
|
||||
lastSyncTimeStamp: null,
|
||||
userCount: null,
|
||||
users: null,
|
||||
capabilities: null,
|
||||
groups: null,
|
||||
manager: null
|
||||
}
|
||||
],
|
||||
capabilities: null,
|
||||
apps: [],
|
||||
primaryGroup: null,
|
||||
tenantPictureId: null,
|
||||
tenantName: 'test'
|
||||
});
|
||||
}
|
||||
|
||||
get401getProfile(): void {
|
||||
nock(this.host, { encodedQueryParams: true }).get('/activiti-app/api/enterprise/profile').reply(401);
|
||||
}
|
||||
|
||||
get200getProfilePicture(): void {
|
||||
nock(this.host, { encodedQueryParams: true }).get('/activiti-app/api/enterprise/profile-picture').reply(200, 'BUFFERSIZE');
|
||||
}
|
||||
}
|
212
lib/js-api/test/mockObjects/process-services/reports.mock.ts
Normal file
212
lib/js-api/test/mockObjects/process-services/reports.mock.ts
Normal file
@@ -0,0 +1,212 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import nock from 'nock';
|
||||
import { BaseMock } from '../base.mock';
|
||||
|
||||
const fakeReportList = [
|
||||
{ id: 11011, name: 'Process definition heat map' },
|
||||
{ id: 11012, name: 'Process definition overview' },
|
||||
{ id: 11013, name: 'Process instances overview' },
|
||||
{ id: 11014, name: 'Task overview' },
|
||||
{ id: 11015, name: 'Task service level agreement' }
|
||||
];
|
||||
|
||||
const fakeReportParams = {
|
||||
id: 11013,
|
||||
name: 'Process instances overview',
|
||||
created: '2016-12-07T13:26:40.095+0000',
|
||||
definition:
|
||||
'{"parameters":[{"id":"processDefinitionId","name":null,"nameKey":"REPORTING.DEFAULT-REPORTS.PROCESS-INSTANCES-OVERVIEW.PROCESS-DEFINITION","type":"processDefinition","value":null,"dependsOn":null},' +
|
||||
'{"id":"dateRange","name":null,"nameKey":"REPORTING.DEFAULT-REPORTS.PROCESS-INSTANCES-OVERVIEW.DATE-RANGE","type":"dateRange","value":null,"dependsOn":null},' +
|
||||
'{"id":"slowProcessInstanceInteger","name":null,"nameKey":"REPORTING.DEFAULT-REPORTS.PROCESS-INSTANCES-OVERVIEW.SLOW-PROC-INST-NUMBER","type":"integer","value":10,"dependsOn":null},' +
|
||||
'{"id":"status","name":null,"nameKey":"REPORTING.PROCESS-STATUS","type":"status","value":null,"dependsOn":null}' +
|
||||
']}'
|
||||
};
|
||||
|
||||
const fakeChartReports = {
|
||||
elements: [
|
||||
{
|
||||
id: 'id10889073739455',
|
||||
type: 'table',
|
||||
rows: [
|
||||
['__KEY_REPORTING.DEFAULT-REPORTS.PROCESS-DEFINITION-OVERVIEW.GENERAL-TABLE-TOTAL-PROCESS-DEFINITIONS', '10'],
|
||||
['__KEY_REPORTING.DEFAULT-REPORTS.PROCESS-DEFINITION-OVERVIEW.GENERAL-TABLE-TOTAL-PROCESS-INSTANCES', '63'],
|
||||
['__KEY_REPORTING.DEFAULT-REPORTS.PROCESS-DEFINITION-OVERVIEW.GENERAL-TABLE-ACTIVE-PROCESS-INSTANCES', '5'],
|
||||
['__KEY_REPORTING.DEFAULT-REPORTS.PROCESS-DEFINITION-OVERVIEW.GENERAL-TABLE-COMPLETED-PROCESS-INSTANCES', '52']
|
||||
],
|
||||
collapseable: false,
|
||||
collapsed: false,
|
||||
showRowIndex: false
|
||||
},
|
||||
{
|
||||
id: 'id10889073934509',
|
||||
type: 'pieChart',
|
||||
title: 'Total process instances overview',
|
||||
titleKey: 'REPORTING.DEFAULT-REPORTS.PROCESS-DEFINITION-OVERVIEW.PROC-INST-CHART-TITLE',
|
||||
values: [
|
||||
{ key: 'Activiti', y: 13, keyAndValue: ['Activiti', '13'] },
|
||||
{
|
||||
key: 'Second Process',
|
||||
y: 5,
|
||||
keyAndValue: ['Second Process', '5']
|
||||
},
|
||||
{ key: 'Process Custom Name', y: 3, keyAndValue: ['Process Custom Name', '3'] },
|
||||
{
|
||||
key: 'Simple process',
|
||||
y: 29,
|
||||
keyAndValue: ['Simple process', '29']
|
||||
},
|
||||
{ key: 'Third Process', y: 7, keyAndValue: ['Third Process', '7'] }
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 'id10889074082883',
|
||||
type: 'table',
|
||||
title: 'Process definition details',
|
||||
titleKey: 'REPORTING.DEFAULT-REPORTS.PROCESS-DEFINITION-OVERVIEW.DETAIL-TABLE',
|
||||
columnNames: ['Process definition', 'Total', 'Active', 'Completed'],
|
||||
columnNameKeys: [
|
||||
'REPORTING.DEFAULT-REPORTS.PROCESS-DEFINITION-OVERVIEW.DETAIL-TABLE-PROCESS',
|
||||
'REPORTING.DEFAULT-REPORTS.PROCESS-DEFINITION-OVERVIEW.DETAIL-TABLE-TOTAL',
|
||||
'REPORTING.DEFAULT-REPORTS.PROCESS-DEFINITION-OVERVIEW.DETAIL-TABLE-ACTIVE',
|
||||
'REPORTING.DEFAULT-REPORTS.PROCESS-DEFINITION-OVERVIEW.DETAIL-TABLE-COMPLETED'
|
||||
],
|
||||
columnsCentered: [false, false, false, false],
|
||||
rows: [
|
||||
['Activiti', '13', '3', '10'],
|
||||
['Process Custom Name', '3', '0', '3'],
|
||||
['Second Process', '5', '1', '4'],
|
||||
['Simple process', '29', '1', '28'],
|
||||
['Third Process', '7', '0', '7']
|
||||
],
|
||||
collapseable: false,
|
||||
collapsed: false,
|
||||
showRowIndex: true
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
const fakeProcessDefinitionsNoApp: any[] = [
|
||||
{
|
||||
id: 'Process_sid-0FF10DA3-E2BD-4E6A-9013-6D66FC8A4716:1:30004',
|
||||
name: 'Fake Process Name 1',
|
||||
description: null,
|
||||
key: 'Process_sid-0FF10DA3-E2BD-4E6A-9013-6D66FC8A4716',
|
||||
category: 'https://www.activiti.org/processdef',
|
||||
version: 1,
|
||||
deploymentId: '30001',
|
||||
tenantId: 'tenant_1',
|
||||
metaDataValues: [],
|
||||
hasStartForm: false
|
||||
},
|
||||
{
|
||||
id: 'SecondProcess:1:15027',
|
||||
name: 'Fake Process Name 2',
|
||||
description: 'fdsdf',
|
||||
key: 'SecondProcess',
|
||||
category: 'https://www.activiti.org/processdef',
|
||||
version: 1,
|
||||
deploymentId: '15024',
|
||||
tenantId: 'tenant_1',
|
||||
metaDataValues: [],
|
||||
hasStartForm: false
|
||||
},
|
||||
{
|
||||
id: 'Simpleprocess:15:10004',
|
||||
name: 'Fake Process Name 3',
|
||||
description: null,
|
||||
key: 'Simpleprocess',
|
||||
category: 'https://www.activiti.org/processdef',
|
||||
version: 15,
|
||||
deploymentId: '10001',
|
||||
tenantId: 'tenant_1',
|
||||
metaDataValues: [],
|
||||
hasStartForm: false
|
||||
},
|
||||
{
|
||||
id: 'fruitorderprocess:5:42530',
|
||||
name: 'Fake Process Name 4',
|
||||
description: null,
|
||||
key: 'fruitorderprocess',
|
||||
category: 'https://www.activiti.org/processdef',
|
||||
version: 5,
|
||||
deploymentId: '42527',
|
||||
tenantId: 'tenant_1',
|
||||
metaDataValues: [],
|
||||
hasStartForm: false
|
||||
}
|
||||
];
|
||||
|
||||
export class ReportsMock extends BaseMock {
|
||||
get200ResponseCreateDefaultReport(): void {
|
||||
nock(this.host, { encodedQueryParams: true }).post('/activiti-app/app/rest/reporting/default-reports').reply(200);
|
||||
}
|
||||
|
||||
get200ResponseTasksByProcessDefinitionId(reportId: string, processDefinitionId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get('/activiti-app/app/rest/reporting/report-params/' + reportId + '/tasks')
|
||||
.query({ processDefinitionId })
|
||||
.reply(200, ['Fake Task 1', 'Fake Task 2', 'Fake Task 3']);
|
||||
}
|
||||
|
||||
get200ResponseReportList(): void {
|
||||
nock(this.host, { encodedQueryParams: true }).get('/activiti-app/app/rest/reporting/reports').reply(200, fakeReportList);
|
||||
}
|
||||
|
||||
get200ResponseReportParams(reportId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get('/activiti-app/app/rest/reporting/report-params/' + reportId)
|
||||
.reply(200, fakeReportParams);
|
||||
}
|
||||
|
||||
get200ResponseReportsByParams(reportId: string, paramsQuery: { status: string }): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.post('/activiti-app/app/rest/reporting/report-params/' + reportId, paramsQuery)
|
||||
.reply(200, fakeChartReports);
|
||||
}
|
||||
|
||||
get200ResponseProcessDefinitions(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get('/activiti-app/app/rest/reporting/process-definitions')
|
||||
.reply(200, fakeProcessDefinitionsNoApp);
|
||||
}
|
||||
|
||||
get200ResponseUpdateReport(reportId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.put('/activiti-app/app/rest/reporting/reports/' + reportId)
|
||||
.reply(200);
|
||||
}
|
||||
|
||||
get200ResponseExportReport(reportId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.post('/activiti-app/app/rest/reporting/reports/' + reportId + '/export-to-csv')
|
||||
.reply(200, 'CSV');
|
||||
}
|
||||
|
||||
get200ResponseSaveReport(reportId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.post('/activiti-app/app/rest/reporting/reports/' + reportId)
|
||||
.reply(200);
|
||||
}
|
||||
|
||||
get200ResponseDeleteReport(reportId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.delete('/activiti-app/app/rest/reporting/reports/' + reportId)
|
||||
.reply(200);
|
||||
}
|
||||
}
|
@@ -0,0 +1,56 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import nock from 'nock';
|
||||
import { BaseMock } from '../base.mock';
|
||||
|
||||
export class TaskFormMock extends BaseMock {
|
||||
get200getTaskFormVariables(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get('/activiti-app/api/enterprise/task-forms/5028/variables')
|
||||
.reply(
|
||||
200,
|
||||
[{ id: 'initiator', type: 'string', value: '1001' }],
|
||||
[
|
||||
'Server',
|
||||
'Apache-Coyote/1.1',
|
||||
'set-cookie',
|
||||
'ACTIVITI_REMEMBER_ME=NjdOdGwvcUtFTkVEczQyMGh4WFp5QT09OmpUL1UwdFVBTC94QTJMTFFUVFgvdFE9PQ',
|
||||
'X-Content-Type-Options',
|
||||
'nosniff',
|
||||
'X-XSS-Protection',
|
||||
'1; mode=block',
|
||||
'Cache-Control',
|
||||
'no-cache, no-store, max-age=0, must-revalidate',
|
||||
'Pragma',
|
||||
'no-cache',
|
||||
'Expires',
|
||||
'0',
|
||||
'X-Frame-Options',
|
||||
'SAMEORIGIN',
|
||||
'Content-Type',
|
||||
'application/json',
|
||||
'Transfer-Encoding',
|
||||
'chunked',
|
||||
'Date',
|
||||
'Tue, 01 Nov 2016 19:43:36 GMT',
|
||||
'Connection',
|
||||
'close'
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
1046
lib/js-api/test/mockObjects/process-services/tasks.mock.ts
Normal file
1046
lib/js-api/test/mockObjects/process-services/tasks.mock.ts
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,66 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import nock from 'nock';
|
||||
import { BaseMock } from '../base.mock';
|
||||
|
||||
export class UserFiltersMock extends BaseMock {
|
||||
get200getUserTaskFilters(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get('/activiti-app/api/enterprise/filters/tasks')
|
||||
.query({ appId: '1' })
|
||||
.reply(200, {
|
||||
size: 4,
|
||||
total: 4,
|
||||
start: 0,
|
||||
data: [
|
||||
{
|
||||
id: 2,
|
||||
name: 'Involved Tasks',
|
||||
appId: 1,
|
||||
recent: true,
|
||||
icon: 'glyphicon-align-left',
|
||||
filter: { sort: 'created-desc', name: '', state: 'open', assignment: 'involved' }
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: 'My Tasks',
|
||||
appId: 1,
|
||||
recent: false,
|
||||
icon: 'glyphicon-inbox',
|
||||
filter: { sort: 'created-desc', name: '', state: 'open', assignment: 'assignee' }
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
name: 'Queued Tasks',
|
||||
appId: 1,
|
||||
recent: false,
|
||||
icon: 'glyphicon-record',
|
||||
filter: { sort: 'created-desc', name: '', state: 'open', assignment: 'candidate' }
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: 'Completed Tasks',
|
||||
appId: 1,
|
||||
recent: false,
|
||||
icon: 'glyphicon-ok-sign',
|
||||
filter: { sort: 'created-desc', name: '', state: 'completed', assignment: 'involved' }
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user