[ACA-2951]Add APS1 calls to adf testing package (#5566)

* Add APS1 calls to adf testing package

* no message

* Change to use AlfrescoApi instead of ApiService

* Refactor process-services tests to use API calls implementation from testing package

* Fix resource file

* no message

* Fix widget tests

* Fix tests

* no message

* Unblocking travis
This commit is contained in:
Cristina Jalba
2020-04-03 11:15:06 +03:00
committed by GitHub
parent 179bdb2790
commit 03a93e45d9
55 changed files with 325 additions and 153 deletions

View File

@@ -0,0 +1,57 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* 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 { AlfrescoApiCompatibility as AlfrescoApi } from '@alfresco/js-api';
import { Logger } from '../../utils/logger';
import * as remote from 'selenium-webdriver/remote';
import { browser } from 'protractor';
import * as fs from 'fs';
export class AppPublish {
comment: string = '';
force: boolean = true;
}
export class ApplicationService {
api: AlfrescoApi;
constructor(api: AlfrescoApi) {
this.api = api;
}
async importPublishDeployApp(appFileLocation, option = {}) {
try {
const appCreated = await this.importApplication(appFileLocation, option);
const publishApp = await this.api.activiti.appsApi.publishAppDefinition(appCreated.id, new AppPublish());
await this.api.activiti.appsApi.deployAppDefinitions({ appDefinitions: [{ id: publishApp.appDefinition.id }] });
return appCreated;
} catch (error) {
Logger.error('Import Publish Deploy Application - Service error, Response: ', JSON.parse(JSON.stringify(error)).response.text);
}
}
async importApplication(appFileLocation, options = {}): Promise<any> {
try {
browser.setFileDetector(new remote.FileDetector());
const file = fs.createReadStream(appFileLocation);
return await this.api.activiti.appsDefinitionApi.importAppDefinition(file, options);
} catch (error) {
Logger.error('Import Application - Service error, Response: ', JSON.parse(JSON.stringify(error)).response.text);
}
}
}

View File

@@ -0,0 +1,43 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* 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 { AlfrescoApiCompatibility as AlfrescoApi } from '@alfresco/js-api';
import { Logger } from '../../utils/logger';
export class ModelsActions {
api: AlfrescoApi;
constructor(api: AlfrescoApi) {
this.api = api;
}
async deleteVersionModel(modelId) {
try {
return this.api.activiti.modelsApi.deleteModel(modelId, { cascade: false, deleteRuntimeApp : true });
} catch (error) {
Logger.error('Delete Model Version - Service error, Response: ', JSON.parse(JSON.stringify(error)).response.text);
}
}
async deleteEntireModel(modelId) {
try {
return this.api.activiti.modelsApi.deleteModel(modelId, { cascade: true, deleteRuntimeApp : true });
} catch (error) {
Logger.error('Delete Model - Service error, Response: ', JSON.parse(JSON.stringify(error)).response.text);
}
}
}

View File

@@ -0,0 +1,19 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* 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 './applications.service';
export * from './models.service';

View File

@@ -16,4 +16,5 @@
*/
export * from './identity/public-api';
export * from './APS/public-api';
export * from './api.service';