mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[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:
57
lib/testing/src/lib/core/actions/APS/applications.service.ts
Normal file
57
lib/testing/src/lib/core/actions/APS/applications.service.ts
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
43
lib/testing/src/lib/core/actions/APS/models.service.ts
Normal file
43
lib/testing/src/lib/core/actions/APS/models.service.ts
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
19
lib/testing/src/lib/core/actions/APS/public-api.ts
Normal file
19
lib/testing/src/lib/core/actions/APS/public-api.ts
Normal 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';
|
@@ -16,4 +16,5 @@
|
||||
*/
|
||||
|
||||
export * from './identity/public-api';
|
||||
export * from './APS/public-api';
|
||||
export * from './api.service';
|
||||
|
Reference in New Issue
Block a user